summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2017-09-15 17:36:59 +0200
committerDavid Sterba <dsterba@suse.com>2018-04-05 19:25:35 +0200
commite37739baf4015e21148f04725765686362ca1150 (patch)
treedbab26134d439cc967671b4a45d2ded240ca843b /fs/btrfs/super.c
parent57599c7e7722daf5f8c2dba4b0e4628f5c500771 (diff)
downloadlinux-next-e37739baf4015e21148f04725765686362ca1150.tar.gz
btrfs: allow setting zstd level
Capped at 15 because of currently used encoding, which is also a reasonable limit because highest levels shine only on blocks much bigger than btrfs' 128KB. Memory is allocated for the biggest supported level rather than for what is actually used. Signed-off-by: Adam Borowski <kilobyte@angband.pl> [ refresh after changes in previous patch ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 170baef49fae..fa1420a3f0cf 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -556,9 +556,10 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
btrfs_clear_opt(info->mount_opt, NODATASUM);
btrfs_set_fs_incompat(info, COMPRESS_LZO);
no_compress = 0;
- } else if (strcmp(args[0].from, "zstd") == 0) {
+ } else if (strncmp(args[0].from, "zstd", 4) == 0) {
compress_type = "zstd";
info->compress_type = BTRFS_COMPRESS_ZSTD;
+ info->compress_level = btrfs_compress_str2level(args[0].from);
btrfs_set_opt(info->mount_opt, COMPRESS);
btrfs_clear_opt(info->mount_opt, NODATACOW);
btrfs_clear_opt(info->mount_opt, NODATASUM);