From: Theodore Ts'o Date: Mon, 19 Mar 2018 22:23:04 +0000 (-0400) Subject: libext2fs: teach e2image imager to handle bigalloc file systems X-Git-Tag: v1.44.1~12 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=47438fccc19ceddb8a640e861674ff7b1ad04730;p=tools%2Fe2fsprogs.git libext2fs: teach e2image imager to handle bigalloc file systems Previously, "mke2fs -t ext4 -O bigalloc /tmp/foo.img 4G ; e2image /tmp/foo.img /tmp/foo.e2i" would result in e2image dumping core. Fix ext2fs_image_bitmap_write() so it handles file systems with bigalloc correctly. Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/imager.c b/lib/ext2fs/imager.c index 357443f..efb85b9 100644 --- a/lib/ext2fs/imager.c +++ b/lib/ext2fs/imager.c @@ -309,8 +309,8 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags) } bmap = fs->block_map; itr = fs->super->s_first_data_block; - cnt = EXT2_GROUPS_TO_BLOCKS(fs->super, fs->group_desc_count); - size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8; + cnt = EXT2_GROUPS_TO_CLUSTERS(fs->super, fs->group_desc_count); + size = EXT2_CLUSTERS_PER_GROUP(fs->super) / 8; } total_size = size * fs->group_desc_count;