diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 6f89bcc4e555..df40b7c5f06b 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1055,6 +1055,13 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, | |||
1055 | if (!max_to_defrag) | 1055 | if (!max_to_defrag) |
1056 | max_to_defrag = last_index - 1; | 1056 | max_to_defrag = last_index - 1; |
1057 | 1057 | ||
1058 | /* | ||
1059 | * make writeback starts from i, so the defrag range can be | ||
1060 | * written sequentially. | ||
1061 | */ | ||
1062 | if (i < inode->i_mapping->writeback_index) | ||
1063 | inode->i_mapping->writeback_index = i; | ||
1064 | |||
1058 | while (i <= last_index && defrag_count < max_to_defrag) { | 1065 | while (i <= last_index && defrag_count < max_to_defrag) { |
1059 | /* | 1066 | /* |
1060 | * make sure we stop running if someone unmounts | 1067 | * make sure we stop running if someone unmounts |