Skip to content

Commit

Permalink
Btrfs: update to the right index of defragment
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
liub authored and chrismason-xx committed Mar 29, 2012
1 parent 66c2689 commit e1f041e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit e1f041e

Please sign in to comment.