aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLiu Bo <liubo2009@cn.fujitsu.com>2012-01-26 15:01:12 -0500
committerChris Mason <chris.mason@oracle.com>2012-01-26 15:01:12 -0500
commit7ec31b548a17f773ab6289e795ed3a6820e8b56e (patch)
treec0c738e7c27e4ac6185f02acd76de64986218906 /fs
parent0b485143d835c019cddc45f46e4b3873dcc9aa4e (diff)
Btrfs: do not defrag a file partially
xfstests 218 complains that btrfs defrags a file partially: After: 1 Write backwards sync, but contiguous - should defrag to 1 extent Before: 10 -After: 1 +After: 2 To fix this, we need to set max_to_defrag count properly. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.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 6834be4c870..0b06a5ca8af 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1066,7 +1066,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
1066 i = range->start >> PAGE_CACHE_SHIFT; 1066 i = range->start >> PAGE_CACHE_SHIFT;
1067 } 1067 }
1068 if (!max_to_defrag) 1068 if (!max_to_defrag)
1069 max_to_defrag = last_index; 1069 max_to_defrag = last_index + 1;
1070 1070
1071 /* 1071 /*
1072 * make writeback starts from i, so the defrag range can be 1072 * make writeback starts from i, so the defrag range can be