]> git.hungrycats.org Git - linux/commitdiff
Revert "btrfs: add no_mtime flag to btrfs-extent-same"
authorZygo Blaxell <zblaxell@thirteen.furryterror.org>
Sat, 27 Jun 2015 21:35:33 +0000 (17:35 -0400)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Sat, 27 Jun 2015 21:35:33 +0000 (17:35 -0400)
This reverts commit e9b1e79bc5d2e84472feef75b98d3cd29a5c4937.

fs/btrfs/ioctl.c
include/uapi/linux/btrfs.h

index 37e4f5538a3e052c5652623a8d00f27f9312b305..aae4297de0a207361a6fb65e088f0b0cd882608b 100644 (file)
@@ -87,8 +87,7 @@ struct btrfs_ioctl_received_subvol_args_32 {
 
 
 static int btrfs_clone(struct inode *src, struct inode *inode,
-                      u64 off, u64 olen, u64 olen_aligned, u64 destoff,
-                      int flags);
+                      u64 off, u64 olen, u64 olen_aligned, u64 destoff);
 
 /* Mask out flags that are inappropriate for the given type of inode. */
 static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags)
@@ -2968,7 +2967,7 @@ static int extent_same_check_offsets(struct inode *inode, u64 off, u64 *plen,
 }
 
 static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
-                            struct inode *dst, u64 dst_loff, int flags)
+                            struct inode *dst, u64 dst_loff)
 {
        int ret;
        u64 len = olen;
@@ -3048,8 +3047,7 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
        /* pass original length for comparison so we stay within i_size */
        ret = btrfs_cmp_data(src, loff, dst, dst_loff, olen, &cmp);
        if (ret == 0)
-               ret = btrfs_clone(src, dst, loff, olen, len, dst_loff,
-                                 flags);
+               ret = btrfs_clone(src, dst, loff, olen, len, dst_loff);
 
        if (same_inode)
                unlock_extent(&BTRFS_I(src)->io_tree, same_lock_start,
@@ -3083,7 +3081,6 @@ static long btrfs_ioctl_file_extent_same(struct file *file,
        u64 bs = BTRFS_I(src)->root->fs_info->sb->s_blocksize;
        bool is_admin = capable(CAP_SYS_ADMIN);
        u16 count;
-       int flags = 0;
 
        if (!(file->f_mode & FMODE_READ))
                return -EINVAL;
@@ -3135,11 +3132,6 @@ static long btrfs_ioctl_file_extent_same(struct file *file,
        if (!S_ISREG(src->i_mode))
                goto out;
 
-       ret = -EINVAL;
-       if (same->flags & ~BTRFS_EXTENT_SAME_FLAG_MASK)
-               goto out;
-       flags = same->flags;
-
        /* pre-format output fields to sane values */
        for (i = 0; i < count; i++) {
                same->info[i].bytes_deduped = 0ULL;
@@ -3165,8 +3157,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file,
                        info->status = -EACCES;
                } else {
                        info->status = btrfs_extent_same(src, off, len, dst,
-                                                        info->logical_offset,
-                                                        flags);
+                                                       info->logical_offset);
                        if (info->status == 0)
                                info->bytes_deduped += len;
                }
@@ -3221,17 +3212,13 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
                                     struct inode *inode,
                                     u64 endoff,
                                     const u64 destoff,
-                                    const u64 olen,
-                                    int flags)
+                                    const u64 olen)
 {
        struct btrfs_root *root = BTRFS_I(inode)->root;
        int ret;
 
        inode_inc_iversion(inode);
-       if (flags & BTRFS_EXTENT_SAME_NO_MTIME)
-               inode->i_ctime = CURRENT_TIME;
-       else
-               inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+       inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        /*
         * We round up to the block size at eof when determining which
         * extents to clone above, but shouldn't round up the file size.
@@ -3316,13 +3303,13 @@ static void clone_update_extent_map(struct inode *inode,
  * @inode: Inode to clone to
  * @off: Offset within source to start clone from
  * @olen: Original length, passed by user, of range to clone
- * @olen_aligned: Block-aligned value of olen
+ * @olen_aligned: Block-aligned value of olen, extent_same uses
+ *               identical values here
  * @destoff: Offset within @inode to start clone
- * @flags: clone flags from extent-same
  */
 static int btrfs_clone(struct inode *src, struct inode *inode,
                       const u64 off, const u64 olen, const u64 olen_aligned,
-                      const u64 destoff, int flags)
+                      const u64 destoff)
 {
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_path *path = NULL;
@@ -3646,7 +3633,7 @@ process_slot:
                                              root->sectorsize);
                        ret = clone_finish_inode_update(trans, inode,
                                                        last_dest_end,
-                                                       destoff, olen, flags);
+                                                       destoff, olen);
                        if (ret)
                                goto out;
                        if (new_key.offset + datal >= destoff + len)
@@ -3684,7 +3671,7 @@ process_slot:
                clone_update_extent_map(inode, trans, NULL, last_dest_end,
                                        destoff + len - last_dest_end);
                ret = clone_finish_inode_update(trans, inode, destoff + len,
-                                               destoff, olen, flags);
+                                               destoff, olen);
        }
 
 out:
@@ -3814,7 +3801,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
                btrfs_double_extent_lock(src, off, inode, destoff, len);
        }
 
-       ret = btrfs_clone(src, inode, off, olen, len, destoff, 0);
+       ret = btrfs_clone(src, inode, off, olen, len, destoff);
 
        if (same_inode) {
                u64 lock_start = min_t(u64, off, destoff);
index e2ab01eb1f71f6f1c72990ac4841b15c2f6d1b33..b6dec05c7196a22511e346242724406eef88265b 100644 (file)
@@ -342,14 +342,11 @@ struct btrfs_ioctl_same_extent_info {
        __u32 reserved;
 };
 
-#define        BTRFS_EXTENT_SAME_NO_MTIME      0x1
-#define        BTRFS_EXTENT_SAME_FLAG_MASK     (BTRFS_EXTENT_SAME_NO_MTIME)
-
 struct btrfs_ioctl_same_args {
        __u64 logical_offset;   /* in - start of extent in source */
        __u64 length;           /* in - length of extent */
        __u16 dest_count;       /* in - total elements in info array */
-       __u16 flags;            /* in - see BTRFS_SAME_FLAGS */
+       __u16 reserved1;
        __u32 reserved2;
        struct btrfs_ioctl_same_extent_info info[0];
 };