This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master in repository gfs2-utils.
commit a2ffc35b5e4e7ba01be47b4566ef0b43bc06db6c Author: Andrew Price anprice@redhat.com AuthorDate: Mon Mar 22 11:26:15 2021 +0000
libgfs2: Move gfs1_ri_update() into gfs2_convert
gfs2_convert is the only user of this function. This duplicates a simplified version of ri_update into gfs2_convert which means we can safely make changes to ri_update for gfs2 filesystems.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/convert/gfs2_convert.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ gfs2/libgfs2/libgfs2.h | 1 - gfs2/libgfs2/super.c | 17 ---------------- 3 files changed, 49 insertions(+), 18 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c index dd945032..839e29ba 100644 --- a/gfs2/convert/gfs2_convert.c +++ b/gfs2/convert/gfs2_convert.c @@ -1542,6 +1542,55 @@ static int sanity_check(struct gfs2_sbd *sdp) return error; }
+/** + * gfs1_ri_update - attach rgrps to the super block + * + * Given the rgrp index inode, link in all rgrps into the super block + * and be sure that they can be read. + * + * Returns: 0 on success, -1 on failure. + */ +static int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int quiet) +{ + struct rgrp_tree *rgd; + struct gfs2_rindex *ri; + uint64_t count1 = 0, count2 = 0; + uint64_t errblock = 0; + uint64_t rmax = 0; + struct osi_node *n, *next = NULL; + int ok; + + if (rindex_read(sdp, fd, &count1, &ok)) + goto fail; + for (n = osi_first(&sdp->rgtree); n; n = next) { + next = osi_next(n); + rgd = (struct rgrp_tree *)n; + /* Read resource group header */ + errblock = gfs2_rgrp_read(sdp, rgd); + if (errblock) + return errblock; + count2++; + if (!quiet && count2 % 100 == 0) { + printf("."); + fflush(stdout); + } + ri = &rgd->ri; + if (ri->ri_data0 + ri->ri_data - 1 > rmax) + rmax = ri->ri_data0 + ri->ri_data - 1; + } + + sdp->fssize = rmax; + *rgcount = count1; + if (count1 != count2) + goto fail; + + return 0; + + fail: + gfs2_rgrp_free(sdp, &sdp->rgtree); + return -1; +} + /* ------------------------------------------------------------------------- */ /* init - initialization code */ /* Returns: 0 on success, -1 on failure */ diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index 1f64b59e..12275098 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -634,7 +634,6 @@ extern void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new, uint64_t *dblock, uint32_t *extlen, int prealloc); extern int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset, unsigned int size); -extern int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int quiet); extern struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf); extern struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr); extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf); diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c index 2fc83fea..039b7428 100644 --- a/gfs2/libgfs2/super.c +++ b/gfs2/libgfs2/super.c @@ -354,20 +354,3 @@ int ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int *sane) { return __ri_update(sdp, fd, rgcount, sane, 1); } - -/** - * gfs1_ri_update - attach rgrps to the super block - * Stolen from libgfs2/super.c, but modified to handle gfs1. - * @sdp: - * - * Given the rgrp index inode, link in all rgrps into the super block - * and be sure that they can be read. - * - * Returns: 0 on success, -1 on failure. - */ -int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int quiet) -{ - int sane; - - return __ri_update(sdp, fd, rgcount, &sane, quiet); -}
cluster-commits@lists.fedorahosted.org