diff options
-rw-r--r-- | fs/btrfs/inode.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index eb6aec7bbacb..1be31368e881 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -347,8 +347,9 @@ static noinline int compress_file_range(struct inode *inode, | |||
347 | int will_compress; | 347 | int will_compress; |
348 | int compress_type = root->fs_info->compress_type; | 348 | int compress_type = root->fs_info->compress_type; |
349 | 349 | ||
350 | /* if this is a small write inside eof, kick off a defragbot */ | 350 | /* if this is a small write inside eof, kick off a defrag */ |
351 | if (end <= BTRFS_I(inode)->disk_i_size && (end - start + 1) < 16 * 1024) | 351 | if ((end - start + 1) < 16 * 1024 && |
352 | (start > 0 || end + 1 < BTRFS_I(inode)->disk_i_size)) | ||
352 | btrfs_add_inode_defrag(NULL, inode); | 353 | btrfs_add_inode_defrag(NULL, inode); |
353 | 354 | ||
354 | actual_end = min_t(u64, isize, end + 1); | 355 | actual_end = min_t(u64, isize, end + 1); |
@@ -843,7 +844,8 @@ static noinline int cow_file_range(struct inode *inode, | |||
843 | ret = 0; | 844 | ret = 0; |
844 | 845 | ||
845 | /* if this is a small write inside eof, kick off defrag */ | 846 | /* if this is a small write inside eof, kick off defrag */ |
846 | if (end <= BTRFS_I(inode)->disk_i_size && num_bytes < 64 * 1024) | 847 | if (num_bytes < 64 * 1024 && |
848 | (start > 0 || end + 1 < BTRFS_I(inode)->disk_i_size)) | ||
847 | btrfs_add_inode_defrag(trans, inode); | 849 | btrfs_add_inode_defrag(trans, inode); |
848 | 850 | ||
849 | if (start == 0) { | 851 | if (start == 0) { |