diff options
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index a5c8caaaa099..2798945a1920 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4337,10 +4337,16 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
4337 | trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); | 4337 | trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); |
4338 | return ret; | 4338 | return ret; |
4339 | } | 4339 | } |
4340 | flags = EXT4_GET_BLOCKS_CREATE_UNINIT_EXT | | 4340 | flags = EXT4_GET_BLOCKS_CREATE_UNINIT_EXT; |
4341 | EXT4_GET_BLOCKS_NO_NORMALIZE; | ||
4342 | if (mode & FALLOC_FL_KEEP_SIZE) | 4341 | if (mode & FALLOC_FL_KEEP_SIZE) |
4343 | flags |= EXT4_GET_BLOCKS_KEEP_SIZE; | 4342 | flags |= EXT4_GET_BLOCKS_KEEP_SIZE; |
4343 | /* | ||
4344 | * Don't normalize the request if it can fit in one extent so | ||
4345 | * that it doesn't get unnecessarily split into multiple | ||
4346 | * extents. | ||
4347 | */ | ||
4348 | if (len <= EXT_UNINIT_MAX_LEN << blkbits) | ||
4349 | flags |= EXT4_GET_BLOCKS_NO_NORMALIZE; | ||
4344 | retry: | 4350 | retry: |
4345 | while (ret >= 0 && ret < max_blocks) { | 4351 | while (ret >= 0 && ret < max_blocks) { |
4346 | map.m_lblk = map.m_lblk + ret; | 4352 | map.m_lblk = map.m_lblk + ret; |