e2fsprogs: fix "Illegal block number" for scan_block_bitmap()
PATCH 1/1 e2fsprogs: fix "Illegal block number" for scan_block_bitmap()
From: Robin Dong <[email protected]>
After:
# mke2fs -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg,flex_bg,bigalloc /dev/sda # e2freefrag /dev/sda
It will report error message like:
Illegal block number passed to ext2fs_test_block_bitmap #1732133 for block bitmap for /dev/sda Illegal block number passed to ext2fs_test_block_bitmap #1732134 for block bitmap for /dev/sda Illegal block number passed to ext2fs_test_block_bitmap #1732135 for block bitmap for /dev/sda
One bit in bitmap of bigalloc-ext4 means a cluster not a block, therefore ext2fs_fast_test_block_bitmap2 should check cluster.
--- misc/e2freefrag.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
misc/e2freefrag.c +1 -1
@@ -121,7 +121,7 @@ void scan_block_bitmap(ext2_filsys fs, struct chunk_info *info) chunk_start_blk = blk; } used =ext2fs_fast_test_block_bitmap2 (fs->block_map, - chunk_start_blk); + chunk_start_blk >> fs->cluster_ratio_bits);if (!used) { last_chunk_size++; chunk_free++;
Signature · 1 line
1.7.3.2
Ted Ts'o
AppliedQuoted 8 lines · Robin Dong
From: Robin Dong <[email protected]>
After:
# mke2fs -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg,flex_bg,bigalloc /dev/sda # e2freefrag /dev/sdaIt will report error message like:
Quoted 8 lines
Illegal block number passed to
ext2fs_test_block_bitmap#1732133 for block bitmap for/dev/sdaIllegal block number passed toext2fs_test_block_bitmap#1732134 for block bitmap for/dev/sdaIllegal block number passed toext2fs_test_block_bitmap#1732135 for block bitmap for/dev/sdaOne bit in bitmap of bigalloc-ext4 means a cluster not a block, therefore
ext2fs_fast_test_block_bitmap2should check cluster.Signed-off-by Robin Dong <[email protected]>
Thanks, applied.
- Ted