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@xxxxxxxxxx> --- e2fsck/super.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/e2fsck/super.c b/e2fsck/super.c index 5501c9e2..5e29b64e 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -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) -- 2.16.2.804.g6dcf76e118-goog