diff options
author | Anand Jain <anand.jain@oracle.com> | 2019-04-20 19:48:51 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-04-29 19:02:52 +0200 |
commit | f22125e5d8ae136adb99552d97078702e1ee68ab (patch) | |
tree | 091574a84bd201eff96baa3e9d20b3751c3f2f6c /fs/btrfs/ioctl.c | |
parent | 7c15d41016dc886cc011e3854d855e219759ae68 (diff) | |
download | lwn-f22125e5d8ae136adb99552d97078702e1ee68ab.tar.gz lwn-f22125e5d8ae136adb99552d97078702e1ee68ab.zip |
btrfs: refactor btrfs_set_props to validate externally
In preparation to merge multiple transactions when setting the
compression flags, split btrfs_set_props() validation part outside of
it.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7755b503b348..3f9263ddeff8 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -284,6 +284,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) binode->flags &= ~BTRFS_INODE_COMPRESS; binode->flags |= BTRFS_INODE_NOCOMPRESS; + /* set no-compression no need to validate prop here */ ret = btrfs_set_prop_trans(inode, "btrfs.compression", NULL, 0, 0); if (ret && ret != -ENODATA) @@ -299,6 +300,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) binode->flags |= BTRFS_INODE_COMPRESS; binode->flags &= ~BTRFS_INODE_NOCOMPRESS; + /* compress_type is already validated during mount options */ comp = btrfs_compress_type2str(fs_info->compress_type); if (!comp || comp[0] == 0) comp = btrfs_compress_type2str(BTRFS_COMPRESS_ZLIB); @@ -309,6 +311,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) goto out_drop; } else { + /* reset prop, no need of validate prop here */ ret = btrfs_set_prop_trans(inode, "btrfs.compression", NULL, 0, 0); if (ret && ret != -ENODATA) |