e2fsck: during pass1b delete_file, only free a cluster once

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@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
test-maint
Darrick J. Wong 2014-07-26 16:28:58 -04:00 committed by Theodore Ts'o
parent 9a1d614df2
commit 8dd650ab9a
2 changed files with 4 additions and 2 deletions

View File

@ -625,7 +625,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;

View File

@ -1171,7 +1171,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;
}