Skip to content

Commit

Permalink
btrfs: SETFLAGS ioctl: use helper for compression type conversion
Browse files Browse the repository at this point in the history
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed Jan 22, 2018
1 parent e128f9c commit 9337050
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9337050

Please sign in to comment.