]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: fix the max size calculation for non-extent file
authorKazuya Mio <k-mio@sx.jp.nec.com>
Sat, 26 Nov 2011 02:31:09 +0000 (21:31 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 26 Nov 2011 02:31:09 +0000 (21:31 -0500)
When I create a non-extent file with the maximum size in ext4,
e2fsck detects the following error:

Pass 1: Checking inodes, blocks, and sizes
Inode 12, i_size is 4402345721856, should be 4402345721856. Fix?

As we know, e2fsck checks the size field of the inode in pass 1.
However, in case of the ext4 with the feature of ^extent and huge_file,
the maximum file size calculated in e2fsck is less than the real one.
The patch fixes this problem.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass1.c

index 532e132ac15eabfe62083e78c93e0071ac0822a9..00e46d030aae7f89f336135100fa80180035ee4b 100644 (file)
@@ -583,7 +583,7 @@ void e2fsck_pass1(e2fsck_t ctx)
                max_sizes = EXT2_NDIR_BLOCKS + EXT2_BPP(i);
                max_sizes = max_sizes + EXT2_BPP(i) * EXT2_BPP(i);
                max_sizes = max_sizes + EXT2_BPP(i) * EXT2_BPP(i) * EXT2_BPP(i);
-               max_sizes = (max_sizes * (1UL << i)) - 1;
+               max_sizes = (max_sizes * (1UL << i));
                ext2_max_sizes[i - EXT2_MIN_BLOCK_LOG_SIZE] = max_sizes;
        }
 #undef EXT2_BPP