diff options
author | Robin Dong <sanbai@taobao.com> | 2011-10-26 05:14:27 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-10-26 05:14:27 -0400 |
commit | ebbe027797f67d34708ccfabdb129886d549f9ce (patch) | |
tree | 0195f72d056bc00abd71fce86ce3d6507e1abe76 /fs/ext4/mballoc.c | |
parent | fcbb5515825f1bb20b7a6f75ec48bee61416f879 (diff) |
ext4: use stream-alloc when mb_group_prealloc set to zero
The kernel will crash on
ext4_mb_mark_diskspace_used:
BUG_ON(ac->ac_b_ex.fe_len <= 0);
after we set /sys/fs/ext4/sda/mb_group_prealloc to zero and create new files in an ext4 filesystem.
The reason is: ac_b_ex.fe_len also set to zero(mb_group_prealloc) in ext4_mb_normalize_group_request
because the ac_flags contains EXT4_MB_HINT_GROUP_ALLOC.
I think when someone set mb_group_prealloc to zero, it means DO NOT USE GROUP PREALLOCATION,
so we should set alloc-strategy to STREAM in this case.
Signed-off-by: Robin Dong <sanbai@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index cd70b3041185..89762652aae2 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -4006,6 +4006,11 @@ static void ext4_mb_group_or_file(struct ext4_allocation_context *ac) | |||
4006 | return; | 4006 | return; |
4007 | } | 4007 | } |
4008 | 4008 | ||
4009 | if (sbi->s_mb_group_prealloc <= 0) { | ||
4010 | ac->ac_flags |= EXT4_MB_STREAM_ALLOC; | ||
4011 | return; | ||
4012 | } | ||
4013 | |||
4009 | /* don't use group allocation for large files */ | 4014 | /* don't use group allocation for large files */ |
4010 | size = max(size, isize); | 4015 | size = max(size, isize); |
4011 | if (size > sbi->s_mb_stream_request) { | 4016 | if (size > sbi->s_mb_stream_request) { |