btrfs: drop old_fsflags in btrfs_ioctl_setflags
authorAnand Jain <anand.jain@oracle.com>
Sat, 20 Apr 2019 11:48:56 +0000 (19:48 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:02:53 +0000 (19:02 +0200)
btrfs_inode_flags_to_fsflags() is copied into @old_fsflags and used only
once. Instead used it directly.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c

index add724e95c115deea6e08d577fd7a72d1788ca2e..d459c37578ea5f822d4a911fd513b16a3f0cc9bf 100644 (file)
@@ -187,7 +187,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
        struct btrfs_inode *binode = BTRFS_I(inode);
        struct btrfs_root *root = binode->root;
        struct btrfs_trans_handle *trans;
-       unsigned int fsflags, old_fsflags;
+       unsigned int fsflags;
        int ret;
        umode_t mode;
        const char *comp = NULL;
@@ -215,8 +215,8 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
        mode = inode->i_mode;
 
        fsflags = btrfs_mask_fsflags_for_type(inode, fsflags);
-       old_fsflags = btrfs_inode_flags_to_fsflags(binode->flags);
-       if ((fsflags ^ old_fsflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) {
+       if ((fsflags ^ btrfs_inode_flags_to_fsflags(binode->flags)) &
+           (FS_APPEND_FL | FS_IMMUTABLE_FL)) {
                if (!capable(CAP_LINUX_IMMUTABLE)) {
                        ret = -EPERM;
                        goto out_unlock;