When fixing up block group bitmaps on the new fs, don't try to mark unallocated group metadata blocks; these will be allocated (and marked) later. Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- resize/resize2fs.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 94c0643..a760593 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -242,7 +242,6 @@ static void fix_uninit_block_bitmaps(ext2_filsys fs) { blk64_t blk, lblk; dgrp_t g; - int i; if (!ext2fs_has_group_desc_csum(fs)) return; @@ -257,14 +256,16 @@ static void fix_uninit_block_bitmaps(ext2_filsys fs) lblk - blk + 1); ext2fs_reserve_super_and_bgd(fs, g, fs->block_map); - ext2fs_mark_block_bitmap2(fs->block_map, - ext2fs_block_bitmap_loc(fs, g)); - ext2fs_mark_block_bitmap2(fs->block_map, - ext2fs_inode_bitmap_loc(fs, g)); - for (i = 0, blk = ext2fs_inode_table_loc(fs, g); - i < (unsigned int) fs->inode_blocks_per_group; - i++, blk++) + blk = ext2fs_block_bitmap_loc(fs, g); + if (blk) + ext2fs_mark_block_bitmap2(fs->block_map, blk); + blk = ext2fs_inode_bitmap_loc(fs, g); + if (blk) ext2fs_mark_block_bitmap2(fs->block_map, blk); + blk = ext2fs_inode_table_loc(fs, g); + if (blk) + ext2fs_mark_block_bitmap_range2(fs->block_map, blk, + fs->inode_blocks_per_group); } } -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html