diff options
author | Theodore Ts'o <tytso@mit.edu> | 2012-08-16 11:59:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-25 19:31:42 -0700 |
commit | e1a2e15bd925ff7bac6acc62788f517746abd1e3 (patch) | |
tree | 770c5b3f478071f3248011a3a33933abb3777e9b /fs/ext4 | |
parent | e05ea717652a0ce1a2cf8729535ac90c5aee6734 (diff) |
ext4: fix long mount times on very big file systems
commit 0548bbb85337e532ca2ed697c3e9b227ff2ed4b4 upstream.
Commit 8aeb00ff85a: "ext4: fix overhead calculation used by
ext4_statfs()" introduced a O(n**2) calculation which makes very large
file systems take forever to mount. Fix this with an optimization for
non-bigalloc file systems. (For bigalloc file systems the overhead
needs to be set in the the superblock.)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/super.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 1df262d27ac..41598ee2e85 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3110,6 +3110,10 @@ static int count_overhead(struct super_block *sb, ext4_group_t grp, ext4_group_t i, ngroups = ext4_get_groups_count(sb); int s, j, count = 0; + if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC)) + return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) + + sbi->s_itb_per_group + 2); + first_block = le32_to_cpu(sbi->s_es->s_first_data_block) + (grp * EXT4_BLOCKS_PER_GROUP(sb)); last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1; |