diff options
author | Theodore Ts'o <tytso@mit.edu> | 2012-08-17 09:46:17 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-08-17 09:46:17 -0400 |
commit | 01fc48e8929e45e67527200017cff4e74e4ba054 (patch) | |
tree | e1a4bfe958e9bb0dc2064c45fa2a0db498236a08 /fs/ext4 | |
parent | ecb94f5fdf4b72547fca022421a9dca1672bddd4 (diff) |
ext4: don't load the block bitmap for block groups which have no space
Add a short circuit check to ext4_mb_group_group() so that we don't
bother to load the block bitmap for a block group which does not have
any space available. (Or which does not have enough space until we
are in desperation mode, i.e., when cr == 3.)
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=45741
Reported-by: mirek@me.com
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/mballoc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 8eae94771c45..3a57975b73cc 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1862,6 +1862,12 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac, | |||
1862 | 1862 | ||
1863 | BUG_ON(cr < 0 || cr >= 4); | 1863 | BUG_ON(cr < 0 || cr >= 4); |
1864 | 1864 | ||
1865 | free = grp->bb_free; | ||
1866 | if (free == 0) | ||
1867 | return 0; | ||
1868 | if (cr <= 2 && free < ac->ac_g_ex.fe_len) | ||
1869 | return 0; | ||
1870 | |||
1865 | /* We only do this if the grp has never been initialized */ | 1871 | /* We only do this if the grp has never been initialized */ |
1866 | if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) { | 1872 | if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) { |
1867 | int ret = ext4_mb_init_group(ac->ac_sb, group); | 1873 | int ret = ext4_mb_init_group(ac->ac_sb, group); |
@@ -1869,10 +1875,7 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac, | |||
1869 | return 0; | 1875 | return 0; |
1870 | } | 1876 | } |
1871 | 1877 | ||
1872 | free = grp->bb_free; | ||
1873 | fragments = grp->bb_fragments; | 1878 | fragments = grp->bb_fragments; |
1874 | if (free == 0) | ||
1875 | return 0; | ||
1876 | if (fragments == 0) | 1879 | if (fragments == 0) |
1877 | return 0; | 1880 | return 0; |
1878 | 1881 | ||