On Tue, Sep 14, 2021 at 03:11:04PM -0400, Theodore Ts'o wrote: > Speed up an off-line resize of a 10GB file system to 64TB located on > tmpfs from 90 seconds to 16 seconds by extracting block group bitmaps > using a population count function to count the blocks in use instead > checking each bit in the block bitmap. > > Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> > --- > resize/resize2fs.c | 74 ++++++++++++++-------------------------------- > 1 file changed, 23 insertions(+), 51 deletions(-) > > diff --git a/resize/resize2fs.c b/resize/resize2fs.c > + retval = ext2fs_get_block_bitmap_range2(fs->block_map, > + C2B(blk), fs->super->s_clusters_per_group, bitmap_buf); Whoops, this should be B2C to convert a block number to a cluster number. Hmm, I note that this wasn't picked up by our regression tests. Mental note to self --- we need to add more regression tests to better exercise bigalloc resizes. Currently we have a big warning which gets printed about off-line resizes of bigalloc file systems being experimentlal, but we should aim to do better. :-) - Ted