diff options
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index b128bdc0f55c..1d7fde994521 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2880,12 +2880,11 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, | |||
2880 | if (size < i_size_read(ac->ac_inode)) | 2880 | if (size < i_size_read(ac->ac_inode)) |
2881 | size = i_size_read(ac->ac_inode); | 2881 | size = i_size_read(ac->ac_inode); |
2882 | 2882 | ||
2883 | /* max available blocks in a free group */ | 2883 | /* max size of free chunks */ |
2884 | max = EXT4_BLOCKS_PER_GROUP(ac->ac_sb) - 1 - 1 - | 2884 | max = 2 << bsbits; |
2885 | EXT4_SB(ac->ac_sb)->s_itb_per_group; | ||
2886 | 2885 | ||
2887 | #define NRL_CHECK_SIZE(req, size, max,bits) \ | 2886 | #define NRL_CHECK_SIZE(req, size, max, chunk_size) \ |
2888 | (req <= (size) || max <= ((size) >> bits)) | 2887 | (req <= (size) || max <= (chunk_size)) |
2889 | 2888 | ||
2890 | /* first, try to predict filesize */ | 2889 | /* first, try to predict filesize */ |
2891 | /* XXX: should this table be tunable? */ | 2890 | /* XXX: should this table be tunable? */ |
@@ -2904,16 +2903,16 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, | |||
2904 | size = 512 * 1024; | 2903 | size = 512 * 1024; |
2905 | } else if (size <= 1024 * 1024) { | 2904 | } else if (size <= 1024 * 1024) { |
2906 | size = 1024 * 1024; | 2905 | size = 1024 * 1024; |
2907 | } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, bsbits)) { | 2906 | } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, 2 * 1024)) { |
2908 | start_off = ((loff_t)ac->ac_o_ex.fe_logical >> | 2907 | start_off = ((loff_t)ac->ac_o_ex.fe_logical >> |
2909 | (20 - bsbits)) << 20; | 2908 | (21 - bsbits)) << 21; |
2910 | size = 1024 * 1024; | 2909 | size = 2 * 1024 * 1024; |
2911 | } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, bsbits)) { | 2910 | } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, 4 * 1024)) { |
2912 | start_off = ((loff_t)ac->ac_o_ex.fe_logical >> | 2911 | start_off = ((loff_t)ac->ac_o_ex.fe_logical >> |
2913 | (22 - bsbits)) << 22; | 2912 | (22 - bsbits)) << 22; |
2914 | size = 4 * 1024 * 1024; | 2913 | size = 4 * 1024 * 1024; |
2915 | } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len, | 2914 | } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len, |
2916 | (8<<20)>>bsbits, max, bsbits)) { | 2915 | (8<<20)>>bsbits, max, 8 * 1024)) { |
2917 | start_off = ((loff_t)ac->ac_o_ex.fe_logical >> | 2916 | start_off = ((loff_t)ac->ac_o_ex.fe_logical >> |
2918 | (23 - bsbits)) << 23; | 2917 | (23 - bsbits)) << 23; |
2919 | size = 8 * 1024 * 1024; | 2918 | size = 8 * 1024 * 1024; |