Skip to contentSkip to conversation

GFS2: allow gfs2_write_calc_reserv to use minimum values for rindex

PATCH New Bob Peterson 1 participant 2 messages May 30, 2018 1 message not in the archive GFS2 file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 GFS2: allow gfs2_write_calc_reserv to use minimum values for rindex

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.

---
 fs/gfs2/bmap.c |  2 +-
 fs/gfs2/bmap.h | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
fs/gfs2/bmap.c +1 -1
index 2d2b14371b72..9e6d6775fbf7 100644
@@ -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)) {
fs/gfs2/bmap.h +13 -0
index c68252a61a26..191f5df092f2 100644
@@ -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);
 
#2 lore raw

PATCH 1/1 GFS2: allow gfs2_write_calc_reserv to use minimum values for rindex

Hi,

Please ignore the last email. I sent it to the wrong list. This is a rhel6 patch, not meant for the development kernel tree.

Bob Peterson

----- Original Message -----

Quoted 23 lines

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.