aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2011-09-02 03:56:55 -0400
committerDavid Sterba <dsterba@suse.cz>2011-10-20 12:10:37 -0400
commit5ca496604b5975d371bb669ee6c2394bcbea818f (patch)
tree6a99818b0c54b71c706206bf8981e807e2b0a99b /fs
parent151a31b25e5c941bdd9fdefed650effca223c716 (diff)
Btrfs: fix wrong max_to_defrag in btrfs_defrag_file()
It's off-by-one, and thus we may skip the last page while defragmenting. An example case: # create /mnt/file with 2 4K file extents # btrfs fi defrag /mnt/file # sync # filefrag /mnt/file /mnt/file: 2 extents found So it's not defragmented. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ioctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 323d77f09258..f9026413bcf1 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1052,7 +1052,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
1052 i = range->start >> PAGE_CACHE_SHIFT; 1052 i = range->start >> PAGE_CACHE_SHIFT;
1053 } 1053 }
1054 if (!max_to_defrag) 1054 if (!max_to_defrag)
1055 max_to_defrag = last_index - 1; 1055 max_to_defrag = last_index;
1056 1056
1057 while (i <= last_index && defrag_count < max_to_defrag) { 1057 while (i <= last_index && defrag_count < max_to_defrag) {
1058 /* 1058 /*