If we're forced to delete a crosslinked file, only call ext2fs_block_alloc_stats2() on cluster boundaries, since the block bitmaps are all cluster bitmaps at this point. It's safe to do this only once per cluster since we know all the blocks are going away. Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- e2fsck/pass1b.c | 3 ++- e2fsck/pass2.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c index c0bfa07..2d1b448 100644 --- a/e2fsck/pass1b.c +++ b/e2fsck/pass1b.c @@ -644,7 +644,8 @@ static int delete_file_block(ext2_filsys fs, _("internal error: can't find dup_blk for %llu\n"), *block_nr); } else { - ext2fs_block_alloc_stats2(fs, *block_nr, -1); + if ((*block_nr % EXT2FS_CLUSTER_RATIO(ctx->fs)) == 0) + ext2fs_block_alloc_stats2(fs, *block_nr, -1); pb->dup_blocks++; } pb->cur_cluster = lc; diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index e2bed2f..57d5a16 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -1336,7 +1336,8 @@ static int deallocate_inode_block(ext2_filsys fs, if ((*block_nr < fs->super->s_first_data_block) || (*block_nr >= ext2fs_blocks_count(fs->super))) return 0; - ext2fs_block_alloc_stats2(fs, *block_nr, -1); + if ((*block_nr % EXT2FS_CLUSTER_RATIO(fs)) == 0) + ext2fs_block_alloc_stats2(fs, *block_nr, -1); p->num++; return 0; } -- 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