From 3ec7be439ab8fafb7b82632948e0adb067dde6ab Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 17 Aug 2008 09:41:38 -0400 Subject: [PATCH] e2fsck: Fix max size calculation for extent files A misunderstanding C's precedence rules and the meaning of s_log_block_size meant that we were capping the maximum size of extent-based files at 8GB instead of the 64TB that it should be for filesystems with 4k block sizes. Addresses-Kernel-Bugzilla: #11341 Signed-off-by: "Theodore Ts'o" --- e2fsck/pass1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index a7a2b10..268c2a3 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1926,13 +1926,15 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx, /* too big for a direct/indirect-mapped file */ bad_size = 4; else if ((extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) && - size > (1LL << (32 + fs->super->s_log_block_size) - 1)) + size > + ((1LL << (32 + EXT2_BLOCK_SIZE_BITS(fs->super))) - 1)) /* too big for an extent-based file - 32bit ee_block */ bad_size = 6; } /* i_size for symlinks is checked elsewhere */ if (bad_size && !LINUX_S_ISLNK(inode->i_mode)) { pctx->num = (pb.last_block+1) * fs->blocksize; + pctx->group = bad_size; if (fix_problem(ctx, PR_1_BAD_I_SIZE, pctx)) { inode->i_size = pctx->num; if (!LINUX_S_ISDIR(inode->i_mode)) -- 1.8.3.1