]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Btrfs: update to the right index of defragment
authorLiu Bo <liubo2009@cn.fujitsu.com>
Thu, 29 Mar 2012 13:57:45 +0000 (09:57 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 29 Mar 2012 13:57:45 +0000 (09:57 -0400)
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>
fs/btrfs/ioctl.c

index afde837644e55f3e7c7db58ea693d37680797ca3..18cc23d164a80b7ccc717a83499214b81f395896 100644 (file)
@@ -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);