gfs2: use reservation rgd, not inode rgd for allocating blocks
PATCH 1/1 gfs2: use reservation rgd, not inode rgd for allocating blocks
In reply to a message not in the archiveHi,
Before this patch, function gfs2_alloc_blocks used ip->i_rgd as its starting rgrp for block allocations. In most cases that's correct. However, whenever an rlist is used, it can change the i_rgd value for better performance. Therefore, we should always use the reservation rgd instead. If we don't, the gfs2_rbm_eq function may not determine that the rgd for allocations is the same as the reservation, and therefore, the reservation won't be properly adjusted.
--- fs/gfs2/rgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/rgrp.c +1 -1
@@ -2361,7 +2361,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks, {struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode);struct buffer_head *dibh; -struct gfs2_rbm rbm = { .rgd = ip->i_rgd, }; +struct gfs2_rbm rbm = { .rgd = ip->i_res.rs_rbm.rgd, };unsigned int ndata;u64 block;/* block, within the file system scope */ int error;
Andreas Gruenbacher
maintainerPATCH 1/1 gfs2: use reservation rgd, not inode rgd for allocating blocks
Bob,
Quoted 22 lines · Bob Peterson
Hi,
Before this patch, function
gfs2_alloc_blocksusedip->i_rgdas its starting rgrp for block allocations. In most cases that's correct. However, whenever an rlist is used, it can change thei_rgdvalue for better performance. Therefore, we should always use the reservation rgd instead. If we don't, thegfs2_rbm_eqfunction may not determine that the rgd for allocations is the same as the reservation, and therefore, the reservation won't be properly adjusted.Signed-off-by Bob Peterson <[email protected]>--- fs/gfs2/rgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/gfs2/rgrp.c +0
-0
fs/gfs2/rgrp.c int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks, · line 2367
Quoted 8 lines
fs/gfs2/rgrp.c +1
-1@@ -2361,7 +2361,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks, {struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode);struct buffer_head *dibh; -struct gfs2_rbm rbm = { .rgd = ip->i_rgd, }; +struct gfs2_rbm rbm = { .rgd = ip->i_res.rs_rbm.rgd, };unsigned int ndata;u64 block;/* block, within the file system scope */ int error;
I think we can do better than that; see the two patches I've just posted.
Thanks,
Andreas