diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/mballoc.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 061727acd990..e350885aec30 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1884,15 +1884,19 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac, | |||
1884 | case 0: | 1884 | case 0: |
1885 | BUG_ON(ac->ac_2order == 0); | 1885 | BUG_ON(ac->ac_2order == 0); |
1886 | 1886 | ||
1887 | if (grp->bb_largest_free_order < ac->ac_2order) | ||
1888 | return 0; | ||
1889 | |||
1890 | /* Avoid using the first bg of a flexgroup for data files */ | 1887 | /* Avoid using the first bg of a flexgroup for data files */ |
1891 | if ((ac->ac_flags & EXT4_MB_HINT_DATA) && | 1888 | if ((ac->ac_flags & EXT4_MB_HINT_DATA) && |
1892 | (flex_size >= EXT4_FLEX_SIZE_DIR_ALLOC_SCHEME) && | 1889 | (flex_size >= EXT4_FLEX_SIZE_DIR_ALLOC_SCHEME) && |
1893 | ((group % flex_size) == 0)) | 1890 | ((group % flex_size) == 0)) |
1894 | return 0; | 1891 | return 0; |
1895 | 1892 | ||
1893 | if ((ac->ac_2order > ac->ac_sb->s_blocksize_bits+1) || | ||
1894 | (free / fragments) >= ac->ac_g_ex.fe_len) | ||
1895 | return 1; | ||
1896 | |||
1897 | if (grp->bb_largest_free_order < ac->ac_2order) | ||
1898 | return 0; | ||
1899 | |||
1896 | return 1; | 1900 | return 1; |
1897 | case 1: | 1901 | case 1: |
1898 | if ((free / fragments) >= ac->ac_g_ex.fe_len) | 1902 | if ((free / fragments) >= ac->ac_g_ex.fe_len) |
@@ -2007,7 +2011,7 @@ repeat: | |||
2007 | } | 2011 | } |
2008 | 2012 | ||
2009 | ac->ac_groups_scanned++; | 2013 | ac->ac_groups_scanned++; |
2010 | if (cr == 0) | 2014 | if (cr == 0 && ac->ac_2order < sb->s_blocksize_bits+2) |
2011 | ext4_mb_simple_scan_group(ac, &e4b); | 2015 | ext4_mb_simple_scan_group(ac, &e4b); |
2012 | else if (cr == 1 && sbi->s_stripe && | 2016 | else if (cr == 1 && sbi->s_stripe && |
2013 | !(ac->ac_g_ex.fe_len % sbi->s_stripe)) | 2017 | !(ac->ac_g_ex.fe_len % sbi->s_stripe)) |
@@ -4005,8 +4009,8 @@ ext4_mb_initialize_context(struct ext4_allocation_context *ac, | |||
4005 | len = ar->len; | 4009 | len = ar->len; |
4006 | 4010 | ||
4007 | /* just a dirty hack to filter too big requests */ | 4011 | /* just a dirty hack to filter too big requests */ |
4008 | if (len >= EXT4_CLUSTERS_PER_GROUP(sb) - 10) | 4012 | if (len >= EXT4_CLUSTERS_PER_GROUP(sb)) |
4009 | len = EXT4_CLUSTERS_PER_GROUP(sb) - 10; | 4013 | len = EXT4_CLUSTERS_PER_GROUP(sb); |
4010 | 4014 | ||
4011 | /* start searching from the goal */ | 4015 | /* start searching from the goal */ |
4012 | goal = ar->goal; | 4016 | goal = ar->goal; |