]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
btrfs: SETFLAGS ioctl: use helper for compression type conversion
authorDavid Sterba <dsterba@suse.com>
Tue, 31 Oct 2017 16:32:41 +0000 (17:32 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 22 Jan 2018 15:08:16 +0000 (16:08 +0100)
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c

index a1fd5f7f829859636207156ed58d5092a83b6165..be5bd81b3669c9bda5bc5b38ba0c9dafb71bc883 100644 (file)
@@ -307,12 +307,10 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
                ip->flags |= BTRFS_INODE_COMPRESS;
                ip->flags &= ~BTRFS_INODE_NOCOMPRESS;
 
-               if (fs_info->compress_type == BTRFS_COMPRESS_LZO)
-                       comp = "lzo";
-               else if (fs_info->compress_type == BTRFS_COMPRESS_ZLIB)
-                       comp = "zlib";
-               else
-                       comp = "zstd";
+               comp = btrfs_compress_type2str(fs_info->compress_type);
+               if (!comp || comp[0] == 0)
+                       comp = btrfs_compress_type2str(BTRFS_COMPRESS_ZLIB);
+
                ret = btrfs_set_prop(inode, "btrfs.compression",
                                     comp, strlen(comp), 0);
                if (ret)