mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-11-24 02:25:03 +08:00
e2fsck: release clusters only once in release_inode_blocks
While releasing inode blocks, if bigalloc feature is turned on, release clusters only once. We do it by remembering the last released cluster while iterating through blocks and releasing a cluster only if it is not already released. Signed-off-by: Harshad Shirwadkar <harshads@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
e042869209
commit
707599bf48
@ -71,6 +71,7 @@ struct process_block_struct {
|
||||
int truncated_blocks;
|
||||
int abort;
|
||||
errcode_t errcode;
|
||||
blk64_t last_cluster;
|
||||
};
|
||||
|
||||
static int release_inode_block(ext2_filsys fs,
|
||||
@ -84,6 +85,7 @@ static int release_inode_block(ext2_filsys fs,
|
||||
e2fsck_t ctx;
|
||||
struct problem_context *pctx;
|
||||
blk64_t blk = *block_nr;
|
||||
blk64_t cluster = EXT2FS_B2C(fs, *block_nr);
|
||||
int retval = 0;
|
||||
|
||||
pb = (struct process_block_struct *) priv_data;
|
||||
@ -96,6 +98,11 @@ static int release_inode_block(ext2_filsys fs,
|
||||
if (blk == 0)
|
||||
return 0;
|
||||
|
||||
if (pb->last_cluster == cluster)
|
||||
return 0;
|
||||
|
||||
pb->last_cluster = cluster;
|
||||
|
||||
if ((blk < fs->super->s_first_data_block) ||
|
||||
(blk >= ext2fs_blocks_count(fs->super))) {
|
||||
fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, pctx);
|
||||
@ -188,6 +195,7 @@ static int release_inode_blocks(e2fsck_t ctx, ext2_ino_t ino,
|
||||
pb.abort = 0;
|
||||
pb.errcode = 0;
|
||||
pb.pctx = pctx;
|
||||
pb.last_cluster = 0;
|
||||
if (inode->i_links_count) {
|
||||
pb.truncating = 1;
|
||||
pb.truncate_block = (e2_blkcnt_t)
|
||||
|
Loading…
Reference in New Issue
Block a user