Skip to content

Commit

Permalink
Btrfs: do not defrag a file partially
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
liub authored and chrismason-xx committed Jan 26, 2012
1 parent 0b48514 commit 7ec31b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
i = range->start >> PAGE_CACHE_SHIFT;
}
if (!max_to_defrag)
max_to_defrag = last_index;
max_to_defrag = last_index + 1;

/*
* make writeback starts from i, so the defrag range can be
Expand Down

0 comments on commit 7ec31b5

Please sign in to comment.