gfs2-utils: master - GFS2: libgfs2: build_rgrps was not attaching bh's properly

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


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=b1eca171e483b4b37cd64d78c884649471701467
Commit:        b1eca171e483b4b37cd64d78c884649471701467
Parent:        4cf278d3f53b4330d5aaed82c8d9a004fd7d319e
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:14:23 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 1a297f1..82b4ff4 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -184,10 +184,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;
@@ -208,20 +206,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