This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master in repository gfs2-utils.
commit e2fcfc33ddb1677c581cc87e8f449143f6de7855 Author: Andrew Price anprice@redhat.com AuthorDate: Mon Mar 22 16:28:48 2021 +0000
libgfs2: Remove fs_geometry.c
After moving rgblocks2bitblocks() into rgrp.c it is empty.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/libgfs2/Makefile.am | 1 - gfs2/libgfs2/checks.am | 1 - gfs2/libgfs2/fs_geometry.c | 42 ------------------------------------------ gfs2/libgfs2/libgfs2.h | 2 -- gfs2/libgfs2/rgrp.c | 26 ++++++++++++++++++++++++++ 5 files changed, 26 insertions(+), 46 deletions(-)
diff --git a/gfs2/libgfs2/Makefile.am b/gfs2/libgfs2/Makefile.am index e614415e..54426674 100644 --- a/gfs2/libgfs2/Makefile.am +++ b/gfs2/libgfs2/Makefile.am @@ -39,7 +39,6 @@ libgfs2_la_SOURCES = \ rgrp.c \ super.c \ buf.c \ - fs_geometry.c \ gfs2_disk_hash.c \ ondisk.c \ config.c \ diff --git a/gfs2/libgfs2/checks.am b/gfs2/libgfs2/checks.am index ff4b7583..343b0d89 100644 --- a/gfs2/libgfs2/checks.am +++ b/gfs2/libgfs2/checks.am @@ -7,7 +7,6 @@ check_libgfs2_SOURCES = \ rgrp.c check_rgrp.c \ block_list.c \ crc32c.c \ - fs_geometry.c \ gfs2_disk_hash.c \ ondisk.c \ buf.c \ diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c deleted file mode 100644 index 82f10523..00000000 --- a/gfs2/libgfs2/fs_geometry.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "clusterautoconfig.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> -#include <inttypes.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> - -#include <linux/types.h> -#include "libgfs2.h" -#include "config.h" - -/** - * Given a number of blocks in a resource group, return the number of blocks - * needed for bitmaps. Also calculate the adjusted number of free data blocks - * in the resource group and store it in *ri_data. - */ -uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks, uint32_t *ri_data) -{ - uint32_t mappable = 0; - uint32_t bitblocks = 0; - /* Number of blocks mappable by bitmap blocks with these header types */ - const uint32_t blks_rgrp = GFS2_NBBY * (bsize - sizeof(struct gfs2_rgrp)); - const uint32_t blks_meta = GFS2_NBBY * (bsize - sizeof(struct gfs2_meta_header)); - - while (blks_rgrp + (blks_meta * bitblocks) < ((rgblocks - bitblocks) & ~(uint32_t)3)) - bitblocks++; - - if (bitblocks > 0) - mappable = blks_rgrp + (blks_meta * (bitblocks - 1)); - - *ri_data = (rgblocks - (bitblocks + 1)) & ~(uint32_t)3; - if (mappable < *ri_data) - bitblocks++; - - return bitblocks; -} diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index 1427e2a9..79206967 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -399,10 +399,8 @@ extern int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno); extern int lgfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd); extern int gfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
-/* fs_geometry.c */ extern uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks, uint32_t *ri_data) __attribute__((nonnull(3))); -extern int build_rgrps(struct gfs2_sbd *sdp);
/* fs_ops.c */ #define IS_LEAF (1) diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c index a985e1c8..86e77e18 100644 --- a/gfs2/libgfs2/rgrp.c +++ b/gfs2/libgfs2/rgrp.c @@ -525,6 +525,32 @@ void lgfs2_rgrps_free(lgfs2_rgrps_t *rgs) *rgs = NULL; }
+/** + * Given a number of blocks in a resource group, return the number of blocks + * needed for bitmaps. Also calculate the adjusted number of free data blocks + * in the resource group and store it in *ri_data. + */ +uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks, uint32_t *ri_data) +{ + uint32_t mappable = 0; + uint32_t bitblocks = 0; + /* Number of blocks mappable by bitmap blocks with these header types */ + const uint32_t blks_rgrp = GFS2_NBBY * (bsize - sizeof(struct gfs2_rgrp)); + const uint32_t blks_meta = GFS2_NBBY * (bsize - sizeof(struct gfs2_meta_header)); + + while (blks_rgrp + (blks_meta * bitblocks) < ((rgblocks - bitblocks) & ~(uint32_t)3)) + bitblocks++; + + if (bitblocks > 0) + mappable = blks_rgrp + (blks_meta * (bitblocks - 1)); + + *ri_data = (rgblocks - (bitblocks + 1)) & ~(uint32_t)3; + if (mappable < *ri_data) + bitblocks++; + + return bitblocks; +} + /** * Calculate the fields for a new entry in the resource group index. * ri: A pointer to the resource group index entry to be calculated.