mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
btrfs: show options: use helper to convert compression type string
Use the helper, if the COMPRESS option is set, the result is always defined and not empty. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
802a5c6958
commit
0f628c632d
1 changed files with 2 additions and 7 deletions
|
@ -1243,7 +1243,7 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
|
||||||
static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
|
static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *info = btrfs_sb(dentry->d_sb);
|
struct btrfs_fs_info *info = btrfs_sb(dentry->d_sb);
|
||||||
char *compress_type;
|
const char *compress_type;
|
||||||
|
|
||||||
if (btrfs_test_opt(info, DEGRADED))
|
if (btrfs_test_opt(info, DEGRADED))
|
||||||
seq_puts(seq, ",degraded");
|
seq_puts(seq, ",degraded");
|
||||||
|
@ -1259,12 +1259,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
|
||||||
num_online_cpus() + 2, 8))
|
num_online_cpus() + 2, 8))
|
||||||
seq_printf(seq, ",thread_pool=%d", info->thread_pool_size);
|
seq_printf(seq, ",thread_pool=%d", info->thread_pool_size);
|
||||||
if (btrfs_test_opt(info, COMPRESS)) {
|
if (btrfs_test_opt(info, COMPRESS)) {
|
||||||
if (info->compress_type == BTRFS_COMPRESS_ZLIB)
|
compress_type = btrfs_compress_type2str(info->compress_type);
|
||||||
compress_type = "zlib";
|
|
||||||
else if (info->compress_type == BTRFS_COMPRESS_LZO)
|
|
||||||
compress_type = "lzo";
|
|
||||||
else
|
|
||||||
compress_type = "zstd";
|
|
||||||
if (btrfs_test_opt(info, FORCE_COMPRESS))
|
if (btrfs_test_opt(info, FORCE_COMPRESS))
|
||||||
seq_printf(seq, ",compress-force=%s", compress_type);
|
seq_printf(seq, ",compress-force=%s", compress_type);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue