From: Kazuya Mio Date: Mon, 6 Jul 2009 08:15:24 +0000 (+0900) Subject: e2fsck: optimize loop counter when fixing bitmap padding X-Git-Tag: v1.41.8~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=01ec1268a57b3cc0689ee17035613bebfaea9f87;p=thirdparty%2Fe2fsprogs.git e2fsck: optimize loop counter when fixing bitmap padding If unused range of the bitmap has an unmarked bit, check_[inode/block]_end() marks all bits in the range. However, we know that the checked bits are marked. So this patch fixes loop counter to mark from the unmarked bit. Signed-off-by: Kazuya Mio Signed-off-by: Theodore Ts'o --- diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c index e66038614..8154e1e6a 100644 --- a/e2fsck/pass5.c +++ b/e2fsck/pass5.c @@ -567,7 +567,7 @@ static void check_inode_end(e2fsck_t ctx) for (i = save_inodes_count + 1; i <= end && i > save_inodes_count; i++) { if (!ext2fs_test_inode_bitmap(fs->inode_map, i)) { if (fix_problem(ctx, PR_5_INODE_BMAP_PADDING, &pctx)) { - for (i = save_inodes_count + 1; i <= end; i++) + for (; i <= end; i++) ext2fs_mark_inode_bitmap(fs->inode_map, i); ext2fs_mark_ib_dirty(fs); @@ -612,7 +612,7 @@ static void check_block_end(e2fsck_t ctx) for (i = save_blocks_count + 1; i <= end && i > save_blocks_count; i++) { if (!ext2fs_test_block_bitmap(fs->block_map, i)) { if (fix_problem(ctx, PR_5_BLOCK_BMAP_PADDING, &pctx)) { - for (i = save_blocks_count + 1; i <= end; i++) + for (; i <= end; i++) ext2fs_mark_block_bitmap(fs->block_map, i); ext2fs_mark_bb_dirty(fs);