Commit 063849ea authored by Arnd Hannemann's avatar Arnd Hannemann Committed by Chris Mason

Btrfs: allow mount -o remount,compress=no

Btrfs allows to turn on compression on a mounted and used filesystem
by issuing mount -o remount,compress=lzo.
This patch allows to turn compression off again
while the filesystem is mounted. As suggested by David Sterba
if the compress-force option was set, it is implicitly cleared
if compression is turned off.
Tested-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarArnd Hannemann <arnd@arndnet.de>
parent c5c3c5f3
...@@ -396,15 +396,22 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) ...@@ -396,15 +396,22 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
strcmp(args[0].from, "zlib") == 0) { strcmp(args[0].from, "zlib") == 0) {
compress_type = "zlib"; compress_type = "zlib";
info->compress_type = BTRFS_COMPRESS_ZLIB; info->compress_type = BTRFS_COMPRESS_ZLIB;
btrfs_set_opt(info->mount_opt, COMPRESS);
} else if (strcmp(args[0].from, "lzo") == 0) { } else if (strcmp(args[0].from, "lzo") == 0) {
compress_type = "lzo"; compress_type = "lzo";
info->compress_type = BTRFS_COMPRESS_LZO; info->compress_type = BTRFS_COMPRESS_LZO;
btrfs_set_opt(info->mount_opt, COMPRESS);
} else if (strncmp(args[0].from, "no", 2) == 0) {
compress_type = "no";
info->compress_type = BTRFS_COMPRESS_NONE;
btrfs_clear_opt(info->mount_opt, COMPRESS);
btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);
compress_force = false;
} else { } else {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
btrfs_set_opt(info->mount_opt, COMPRESS);
if (compress_force) { if (compress_force) {
btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); btrfs_set_opt(info->mount_opt, FORCE_COMPRESS);
pr_info("btrfs: force %s compression\n", pr_info("btrfs: force %s compression\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment