commit 4c15e60d5a1750cf43316e8530727afbc63fe57c Author: Bob Peterson <bob@ganesha.peterson> Date: Wed Feb 24 09:05:43 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 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]); } }