[Cluster-devel] [PATCH 15/19] libgfs2: Fix alignment in lgfs2_rgsize_for_data

Andrew Price anprice at redhat.com
Tue Sep 2 12:07:32 UTC 2014


Align the result of this function such that it matches the alignment
done by other functions which calculate a resource group size. This
avoids a situation where the resource group size is smaller than the
contents meant to fill it (e.g. journal file extents).

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/libgfs2/rgrp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 57551c6..8f96c9f 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -525,6 +525,7 @@ unsigned lgfs2_rgsize_for_data(uint64_t blksreq, unsigned bsize)
 	const uint32_t blks_rgrp = GFS2_NBBY * (bsize - sizeof(struct gfs2_rgrp));
 	const uint32_t blks_meta = GFS2_NBBY * (bsize - sizeof(struct gfs2_meta_header));
 	unsigned bitblocks = 1;
+	blksreq = (blksreq + 3) & ~3;
 	if (blksreq > blks_rgrp)
 		bitblocks += ((blksreq - blks_rgrp) + blks_meta - 1) / blks_meta;
 	return bitblocks + blksreq;
-- 
1.9.3




More information about the Cluster-devel mailing list