aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2018-12-12 13:05:59 -0500
committerDavid Sterba <dsterba@suse.com>2019-02-25 08:13:40 -0500
commit57a50e2506df3f603580f8f30247caa7ac902369 (patch)
tree37b759c72d33535790e8428fc81102f38adf66f1
parenta3baaf0d786e22fc86295fda9c58ba0dee07599f (diff)
Btrfs: remove no longer needed range length checks for deduplication
Comparing the content of the pages in the range to deduplicate is now done in generic_remap_checks called by the generic helper generic_remap_file_range_prep(), which takes care of ensuring we do not compare/deduplicate undefined data beyond a file's EOF (range from EOF to the next block boundary). So remove these checks which are now redundant. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/ioctl.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 3f9d7be30bf4..494f0f10d70e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3242,32 +3242,17 @@ static void btrfs_double_extent_lock(struct inode *inode1, u64 loff1,
3242 lock_extent(&BTRFS_I(inode2)->io_tree, loff2, loff2 + len - 1); 3242 lock_extent(&BTRFS_I(inode2)->io_tree, loff2, loff2 + len - 1);
3243} 3243}
3244 3244
3245static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 olen, 3245static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 len,
3246 struct inode *dst, u64 dst_loff) 3246 struct inode *dst, u64 dst_loff)
3247{ 3247{
3248 u64 bs = BTRFS_I(src)->root->fs_info->sb->s_blocksize;
3249 int ret; 3248 int ret;
3250 u64 len = olen;
3251
3252 if (loff + len == src->i_size)
3253 len = ALIGN(src->i_size, bs) - loff;
3254 /*
3255 * For same inode case we don't want our length pushed out past i_size
3256 * as comparing that data range makes no sense.
3257 *
3258 * This effectively means we require aligned extents for the single
3259 * inode case, whereas the other cases allow an unaligned length so long
3260 * as it ends at i_size.
3261 */
3262 if (dst == src && len != olen)
3263 return -EINVAL;
3264 3249
3265 /* 3250 /*
3266 * Lock destination range to serialize with concurrent readpages() and 3251 * Lock destination range to serialize with concurrent readpages() and
3267 * source range to serialize with relocation. 3252 * source range to serialize with relocation.
3268 */ 3253 */
3269 btrfs_double_extent_lock(src, loff, dst, dst_loff, len); 3254 btrfs_double_extent_lock(src, loff, dst, dst_loff, len);
3270 ret = btrfs_clone(src, dst, loff, olen, len, dst_loff, 1); 3255 ret = btrfs_clone(src, dst, loff, len, len, dst_loff, 1);
3271 btrfs_double_extent_unlock(src, loff, dst, dst_loff, len); 3256 btrfs_double_extent_unlock(src, loff, dst, dst_loff, len);
3272 3257
3273 return ret; 3258 return ret;