diff options
author | Arnd Hannemann <arnd@arndnet.de> | 2012-04-16 09:27:51 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-07-23 15:41:38 -0400 |
commit | 063849eafda03edf6872a3728b4a98dcc86290c7 (patch) | |
tree | 0582bdbb8271a39e32117c43a8bda6ee0b01df93 /fs | |
parent | c5c3c5f31e6af2d12b154251a7f23b7f4add6b1d (diff) |
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: David Sterba <dsterba@suse.cz>
Signed-off-by: Arnd Hannemann <arnd@arndnet.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/super.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index ddc2efdda1ab..88a2d2bb2d75 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -396,15 +396,22 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
396 | strcmp(args[0].from, "zlib") == 0) { | 396 | strcmp(args[0].from, "zlib") == 0) { |
397 | compress_type = "zlib"; | 397 | compress_type = "zlib"; |
398 | info->compress_type = BTRFS_COMPRESS_ZLIB; | 398 | info->compress_type = BTRFS_COMPRESS_ZLIB; |
399 | btrfs_set_opt(info->mount_opt, COMPRESS); | ||
399 | } else if (strcmp(args[0].from, "lzo") == 0) { | 400 | } else if (strcmp(args[0].from, "lzo") == 0) { |
400 | compress_type = "lzo"; | 401 | compress_type = "lzo"; |
401 | info->compress_type = BTRFS_COMPRESS_LZO; | 402 | info->compress_type = BTRFS_COMPRESS_LZO; |
403 | btrfs_set_opt(info->mount_opt, COMPRESS); | ||
404 | } else if (strncmp(args[0].from, "no", 2) == 0) { | ||
405 | compress_type = "no"; | ||
406 | info->compress_type = BTRFS_COMPRESS_NONE; | ||
407 | btrfs_clear_opt(info->mount_opt, COMPRESS); | ||
408 | btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); | ||
409 | compress_force = false; | ||
402 | } else { | 410 | } else { |
403 | ret = -EINVAL; | 411 | ret = -EINVAL; |
404 | goto out; | 412 | goto out; |
405 | } | 413 | } |
406 | 414 | ||
407 | btrfs_set_opt(info->mount_opt, COMPRESS); | ||
408 | if (compress_force) { | 415 | if (compress_force) { |
409 | btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); | 416 | btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); |
410 | pr_info("btrfs: force %s compression\n", | 417 | pr_info("btrfs: force %s compression\n", |