]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Handle unaligned length in extent_same
authorMark Fasheh <mfasheh@suse.de>
Mon, 8 Jun 2015 22:05:25 +0000 (15:05 -0700)
committerChris Mason <clm@fb.com>
Wed, 10 Jun 2015 14:02:50 +0000 (07:02 -0700)
commit0dfa2cdb0d8d0238d7b9f6839ee87f363609d08f
treee14df0ebdf2241ee848607f06fc39cef6d5c1db4
parentd47beed18303eafe2bee1f87577b56938d16cc50
btrfs: Handle unaligned length in extent_same

The extent-same code rejects requests with an unaligned length. This
poses a problem when we want to dedupe the tail extent of files as we
skip cloning the portion between i_size and the extent boundary.

If we don't clone the entire extent, it won't be deleted. So the
combination of these behaviors winds up giving us worst-case dedupe on
many files.

We can fix this by allowing a length that extents to i_size and
internally aligining those to the end of the block. This is what
btrfs_ioctl_clone() so we can just copy that check over.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ioctl.c