summaryrefslogtreecommitdiff
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorLiu Bo <liubo2009@cn.fujitsu.com>2012-03-29 09:57:45 -0400
committerChris Mason <chris.mason@oracle.com>2012-03-29 09:57:45 -0400
commite1f041e14cfb322f41f41a308bfede00f1b080cd (patch)
tree8bae36b522a96948be985af03073813e3b0d851f /fs/btrfs/ioctl.c
parent66c2689226ac322fbc9acd2e8e418b78dcd52f51 (diff)
Btrfs: update to the right index of defragment
When we use autodefrag, we forget to update the index which indicates the last page we've dirty. And we'll set dirty flags on a same set of pages again and again. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index afde837644e5..18cc23d164a8 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1186,6 +1186,9 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
if (newer_off == (u64)-1)
break;
+ if (ret > 0)
+ i += ret;
+
newer_off = max(newer_off + 1,
(u64)i << PAGE_CACHE_SHIFT);