From 95a7f15f4606fe69b2b025e061ebd230baae2bb4 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 10 Jul 2011 16:25:55 -0400 Subject: [PATCH] e2fsck: teach e2fsck how to deal with bigalloc in non-extent-mapped inodes Currently the bigalloc implementation in the kernel requires extents, but this restriction might get relaxed in the future. Also, old versions of mke2fs that supported bigalloc during early testing created the root and lost+found directories without using extent-mapped inodes. This makes it possible for e2fsck to better support these old legacy file systems if it comes across them. Signed-off-by: "Theodore Ts'o" --- e2fsck/pass1.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 75491cf..fe5dd9b 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -2199,7 +2199,6 @@ static int process_block(ext2_filsys fs, p->fragmented = 1; } } - p->previous_block = blk; if (p->is_dir && blockcnt > (1 << (21 - fs->super->s_log_block_size))) problem = PR_1_TOOBIG_DIR; @@ -2245,11 +2244,19 @@ static int process_block(ext2_filsys fs, */ if (blockcnt == BLOCK_COUNT_DIND) mark_block_used(ctx, blk); - } else + p->num_blocks++; + } else if (!(ctx->fs->cluster_ratio_bits && + p->previous_block && + (EXT2FS_B2C(ctx->fs, blk) == + EXT2FS_B2C(ctx->fs, p->previous_block)) && + (blk & EXT2FS_CLUSTER_MASK(ctx->fs)) == + (blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) { mark_block_used(ctx, blk); - p->num_blocks++; + p->num_blocks++; + } if (blockcnt >= 0) p->last_block = blockcnt; + p->previous_block = blk; mark_dir: if (p->is_dir && (blockcnt >= 0)) { while (++p->last_db_block < blockcnt) { -- 1.8.3.1