From: Liu Bo Date: Thu, 29 Mar 2012 13:57:45 +0000 (-0400) Subject: Btrfs: update to the right index of defragment X-Git-Tag: v3.4-rc1~22^2~1 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=e1f041e14cfb322f41f41a308bfede00f1b080cd;p=~emulex%2Finfiniband.git 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 Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index afde837644e..18cc23d164a 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);