aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-09-28 00:06:20 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-28 00:06:20 -0400
commit71780577306fd1e76c7a92e3b308db624d03adb9 (patch)
tree37c6dac6475dedbef288a11765f9c6733b526fa8 /fs
parent1693918e0b6988cf5eb93b7da34f30e94360a379 (diff)
ext4: Fix hueristic which avoids group preallocation for closed files
The hueristic was designed to avoid using locality group preallocation when writing the last segment of a closed file. Fix it by move setting size to the maximum of size and isize until after we check whether size == isize. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/mballoc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e9c61896d605..c73d43995b13 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4189,7 +4189,6 @@ static void ext4_mb_group_or_file(struct ext4_allocation_context *ac)
4189 size = ac->ac_o_ex.fe_logical + ac->ac_o_ex.fe_len; 4189 size = ac->ac_o_ex.fe_logical + ac->ac_o_ex.fe_len;
4190 isize = (i_size_read(ac->ac_inode) + ac->ac_sb->s_blocksize - 1) 4190 isize = (i_size_read(ac->ac_inode) + ac->ac_sb->s_blocksize - 1)
4191 >> bsbits; 4191 >> bsbits;
4192 size = max(size, isize);
4193 4192
4194 if ((size == isize) && 4193 if ((size == isize) &&
4195 !ext4_fs_is_busy(sbi) && 4194 !ext4_fs_is_busy(sbi) &&
@@ -4199,6 +4198,7 @@ static void ext4_mb_group_or_file(struct ext4_allocation_context *ac)
4199 } 4198 }
4200 4199
4201 /* don't use group allocation for large files */ 4200 /* don't use group allocation for large files */
4201 size = max(size, isize);
4202 if (size >= sbi->s_mb_stream_request) { 4202 if (size >= sbi->s_mb_stream_request) {
4203 ac->ac_flags |= EXT4_MB_STREAM_ALLOC; 4203 ac->ac_flags |= EXT4_MB_STREAM_ALLOC;
4204 return; 4204 return;