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

Bob Peterson rpeterso at fedoraproject.org
Sat Apr 10 04:54:30 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4c15e60d5a1750cf43316e8530727afbc63fe57c
Commit:        4c15e60d5a1750cf43316e8530727afbc63fe57c
Parent:        7b9e48f534a1b3aa0ff2138b9038379bf3d33ab7
Author:        Bob Peterson <bob at ganesha.peterson>
AuthorDate:    Wed Feb 24 09:05:43 2010 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500

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 28de184..105ce7b 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -190,10 +190,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;
@@ -214,20 +212,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