gfs2-utils: master - libgfs2: Fix alignment in lgfs2_rgsize_for_data

Andrew Price andyp at fedoraproject.org
Fri Sep 5 13:39:45 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=4f674251e9fd93cd38dfbb37b0a6b83a8ec577f1
Commit:        4f674251e9fd93cd38dfbb37b0a6b83a8ec577f1
Parent:        47a254f7f499aee09e08abd1d183e8c730350901
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Tue Aug 26 23:52:10 2014 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Mon Sep 1 16:22:20 2014 +0100

libgfs2: Fix alignment in lgfs2_rgsize_for_data

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 files changed, 1 insertions(+), 0 deletions(-)

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;


More information about the cluster-commits mailing list