This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master in repository gfs2-utils.
commit 16361c6a251407ec99ca1389c42e0f9a91f51309 Author: Andrew Price anprice@redhat.com AuthorDate: Mon Mar 22 16:20:10 2021 +0000
libgfs2: Move build_rgrps into fsck.gfs2
fsck.gfs2 is the last user of this obsoleted function so move it out of libgfs2 ready for when the resource group handling code is overhauled in fsck.gfs2.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/fsck/rgrepair.c | 37 ++++++++++++++++++++++++++++++++++++- gfs2/libgfs2/fs_geometry.c | 45 --------------------------------------------- 2 files changed, 36 insertions(+), 46 deletions(-)
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c index 6628d905..7f0854ca 100644 --- a/gfs2/fsck/rgrepair.c +++ b/gfs2/fsck/rgrepair.c @@ -822,6 +822,41 @@ static void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree, i sdp->rgrps = nrgrp; }
+static int calc_rgrps(struct gfs2_sbd *sdp) +{ + struct osi_node *n, *next = NULL; + struct rgrp_tree *rl; + uint32_t rgblocks, bitblocks; + struct gfs2_rindex *ri; + + for (n = osi_first(&sdp->rgcalc); n; n = next) { + next = osi_next(n); + rl = (struct rgrp_tree *)n; + ri = &rl->ri; + + bitblocks = rgblocks2bitblocks(sdp->bsize, rl->length, &rgblocks); + + ri->ri_addr = rl->start; + ri->ri_length = bitblocks; + ri->ri_data0 = rl->start + bitblocks; + ri->ri_data = rgblocks; + ri->ri_bitbytes = rgblocks / GFS2_NBBY; + + 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; + + if (gfs2_compute_bitstructs(sdp->sd_sb.sb_bsize, rl)) + return -1; + + sdp->blks_total += rgblocks; + sdp->fssize = ri->ri_data0 + ri->ri_data; + } + return 0; +} + /* * gfs2_rindex_calculate - calculate what the rindex should look like * in a perfect world (trust_lvl == open_minded) @@ -864,7 +899,7 @@ static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, int *num_rgs) } /* Compute the default resource group layout as mkfs would have done */ compute_rgrp_layout(sdp, &sdp->rgcalc, 1); - if (build_rgrps(sdp)) { /* Calculate but don't write to disk. */ + if (calc_rgrps(sdp)) { /* Calculate but don't write to disk. */ fprintf(stderr, _("Failed to build resource groups\n")); exit(-1); } diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c index 7de6e777..82f10523 100644 --- a/gfs2/libgfs2/fs_geometry.c +++ b/gfs2/libgfs2/fs_geometry.c @@ -40,48 +40,3 @@ uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks, u
return bitblocks; } - -/** - * build_rgrps - write a bunch of resource groups to disk. - * If fd > 0, write the data to the given file handle. - * Otherwise, use gfs2 buffering in buf.c. - */ -int build_rgrps(struct gfs2_sbd *sdp) -{ - struct osi_node *n, *next = NULL; - struct rgrp_tree *rl; - uint32_t rgblocks, bitblocks; - struct gfs2_rindex *ri; - - for (n = osi_first(&sdp->rgcalc); n; n = next) { - next = osi_next(n); - rl = (struct rgrp_tree *)n; - ri = &rl->ri; - - bitblocks = rgblocks2bitblocks(sdp->bsize, rl->length, &rgblocks); - - ri->ri_addr = rl->start; - ri->ri_length = bitblocks; - ri->ri_data0 = rl->start + bitblocks; - ri->ri_data = rgblocks; - ri->ri_bitbytes = rgblocks / GFS2_NBBY; - - 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; - - if (gfs2_compute_bitstructs(sdp->sd_sb.sb_bsize, rl)) - return -1; - - if (cfg_debug) { - printf("\n"); - gfs2_rindex_print(ri); - } - - sdp->blks_total += rgblocks; - sdp->fssize = ri->ri_data0 + ri->ri_data; - } - return 0; -}
cluster-commits@lists.fedorahosted.org