cluster: STABLE3 - GFS2: libgfs2: build_rgrps was not attaching bh's properly

Bob Peterson rpeterso at fedoraproject.org
Tue Feb 23 22:12:56 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=953b67780ad01166f8d0fc20d57dc8ee65e6d31e
Commit:        953b67780ad01166f8d0fc20d57dc8ee65e6d31e
Parent:        64956e7506854d530a91aa67b404c8664328aa51
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Tue Feb 23 16:10:30 2010 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Tue Feb 23 16:10:30 2010 -0600

GFS2: libgfs2: build_rgrps was not attaching bh's properly

Function build_rgrps, which is only used by mkfs.gfs2 was not
attaching buffers properly to the rgrps in memory.  This patch
corrects the situation.

rhbz#455300
---
 gfs2/libgfs2/fs_geometry.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
index 3fe26fa..a06e8a2 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -182,10 +182,8 @@ void build_rgrps(struct gfs2_sbd *sdp, int do_write)
 	struct rgrp_list *rl;
 	uint32_t rgblocks, bitblocks;
 	struct gfs2_rindex *ri;
-	struct gfs2_rgrp rg;
 	struct gfs2_meta_header mh;
 	unsigned int x;
-	struct gfs2_buffer_head *bh;
 
 	mh.mh_magic = GFS2_MAGIC;
 	mh.mh_type = GFS2_METATYPE_RB;
@@ -206,20 +204,21 @@ void build_rgrps(struct gfs2_sbd *sdp, int do_write)
 		ri->ri_data = rgblocks;
 		ri->ri_bitbytes = rgblocks / GFS2_NBBY;
 
-		memset(&rg, 0, sizeof(rg));
-		rg.rg_header.mh_magic = GFS2_MAGIC;
-		rg.rg_header.mh_type = GFS2_METATYPE_RG;
-		rg.rg_header.mh_format = GFS2_FORMAT_RG;
-		rg.rg_free = rgblocks;
+		memset(&rl->rg, 0, sizeof(rl->rg));
+		rl->rg.rg_header.mh_magic = GFS2_MAGIC;
+		rl->rg.rg_header.mh_type = GFS2_METATYPE_RG;
+		rl->rg.rg_header.mh_format = GFS2_FORMAT_RG;
+		rl->rg.rg_free = rgblocks;
+
+		gfs2_compute_bitstructs(sdp, rl);
 
 		if (do_write) {
 			for (x = 0; x < bitblocks; x++) {
-				bh = bget(sdp, rl->start + x);
+				rl->bh[x] = bget(sdp, rl->start + x);
 				if (x)
-					gfs2_meta_header_out(&mh, bh);
+					gfs2_meta_header_out(&mh, rl->bh[x]);
 				else
-					gfs2_rgrp_out(&rg, bh);
-				brelse(bh);
+					gfs2_rgrp_out(&rl->rg, rl->bh[x]);
 			}
 		}
 


More information about the cluster-commits mailing list