]> git.hungrycats.org Git - linux/commitdiff
Revert "btrfs: Handle unaligned length in extent_same"
authorZygo Blaxell <zblaxell@thirteen.furryterror.org>
Wed, 24 Jun 2015 20:49:56 +0000 (16:49 -0400)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Wed, 24 Jun 2015 20:49:56 +0000 (16:49 -0400)
This reverts commit b4f7e43f9e25403eb81576f0cfdd110d27af85a8.

fs/btrfs/ioctl.c

index 86b0d08944808697f3630e9e74a83a04207406ba..64e8fb639f72d3febf2d91c926cd3abb0bebce30 100644 (file)
@@ -2872,19 +2872,12 @@ static int btrfs_cmp_data(struct inode *src, u64 loff, struct inode *dst,
        return ret;
 }
 
-static int extent_same_check_offsets(struct inode *inode, u64 off, u64 *plen,
-                                    u64 olen)
+static int extent_same_check_offsets(struct inode *inode, u64 off, u64 len)
 {
-       u64 len = *plen;
        u64 bs = BTRFS_I(inode)->root->fs_info->sb->s_blocksize;
 
-       if (off + olen > inode->i_size || off + olen < off)
+       if (off + len > inode->i_size || off + len < off)
                return -EINVAL;
-
-       /* if we extend to eof, continue to block boundary */
-       if (off + len == inode->i_size)
-               *plen = len = ALIGN(inode->i_size, bs) - off;
-
        /* Check that we are block aligned - btrfs_clone() requires this */
        if (!IS_ALIGNED(off, bs) || !IS_ALIGNED(off + len, bs))
                return -EINVAL;
@@ -2892,11 +2885,10 @@ static int extent_same_check_offsets(struct inode *inode, u64 off, u64 *plen,
        return 0;
 }
 
-static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
+static int btrfs_extent_same(struct inode *src, u64 loff, u64 len,
                             struct inode *dst, u64 dst_loff)
 {
        int ret;
-       u64 len = olen;
 
        /*
         * btrfs_clone() can't handle extents in the same file
@@ -2911,11 +2903,11 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
 
        btrfs_double_lock(src, loff, dst, dst_loff, len);
 
-       ret = extent_same_check_offsets(src, loff, &len, olen);
+       ret = extent_same_check_offsets(src, loff, len);
        if (ret)
                goto out_unlock;
 
-       ret = extent_same_check_offsets(dst, dst_loff, &len, olen);
+       ret = extent_same_check_offsets(dst, dst_loff, len);
        if (ret)
                goto out_unlock;
 
@@ -2928,7 +2920,7 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
 
        ret = btrfs_cmp_data(src, loff, dst, dst_loff, len);
        if (ret == 0)
-               ret = btrfs_clone(src, dst, loff, olen, len, dst_loff);
+               ret = btrfs_clone(src, dst, loff, len, len, dst_loff);
 
 out_unlock:
        btrfs_double_unlock(src, loff, dst, dst_loff, len);