[Cluster-devel] [RHEL6.10 PATCH] GFS2: allow gfs2_write_calc_reserv to use minimum values for rindex

Bob Peterson rpeterso at redhat.com
Wed May 30 12:23:51 UTC 2018


Hi,

QE found problems with the previous patch for bug #1384184.
This replacement patch reverts the first patch and adds new code
that passes the QE tests.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1384184
Upstream Status: N/A (not needed upstream)
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=16448851
Tested: by Justin Payne on virt host-029

GFS2: allow gfs2_write_calc_reserv to use minimum values for rindex

Before this patch function gfs2_write_calc_reserv built in several
"slop" blocks into its calculations for the number of blocks required
to do a write. This was fine for the most part, but when the file
system is down to its last blocks, and needs to be extended with
gfs2_grow, the rindex file needs to use a minimum amount of blocks.
This patch makes a special exception for the rindex file, which
now calculates a bare minimum number of blocks we need to allocate.

Signed-off-by: Bob Peterson <rpeterso at redhat.com>
---
 fs/gfs2/bmap.c |  2 +-
 fs/gfs2/bmap.h | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 2d2b14371b72..9e6d6775fbf7 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1375,7 +1375,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
 
 	*alloc_required = 0;
 
-	if (!len || &ip->i_inode == sdp->sd_rindex)
+	if (!len)
 		return 0;
 
 	if (gfs2_is_stuffed(ip)) {
diff --git a/fs/gfs2/bmap.h b/fs/gfs2/bmap.h
index c68252a61a26..191f5df092f2 100644
--- a/fs/gfs2/bmap.h
+++ b/fs/gfs2/bmap.h
@@ -35,6 +35,19 @@ static inline void gfs2_write_calc_reserv(const struct gfs2_inode *ip,
 	unsigned int tmp;
 
 	BUG_ON(gfs2_is_dir(ip));
+	if (&ip->i_inode == sdp->sd_rindex) {
+		const u64 *arr = sdp->sd_heightsize;
+		int h = ip->i_height;
+
+		*data_blocks = (len + sdp->sd_sb.sb_bsize -
+				1) >> sdp->sd_sb.sb_bsize_shift;
+		*ind_blocks = 0;
+		while (i_size_read(&ip->i_inode) + len > arr[h]) {
+			h++;
+			(*ind_blocks)++;
+		}
+		return;
+	}
 	*data_blocks = (len >> sdp->sd_sb.sb_bsize_shift) + 3;
 	*ind_blocks = 3 * (sdp->sd_max_height - 1);
 




More information about the Cluster-devel mailing list