]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Btrfs: allow mount -o remount,compress=no
authorArnd Hannemann <arnd@arndnet.de>
Mon, 16 Apr 2012 13:27:51 +0000 (15:27 +0200)
committerChris Mason <chris.mason@fusionio.com>
Mon, 23 Jul 2012 19:41:38 +0000 (15:41 -0400)
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>
fs/btrfs/super.c

index ddc2efdda1abe4470447da97e7a8fb2c7b0d724c..88a2d2bb2d75e30939f2a5bc11576ea055ffd87f 100644 (file)
@@ -396,15 +396,22 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                            strcmp(args[0].from, "zlib") == 0) {
                                compress_type = "zlib";
                                info->compress_type = BTRFS_COMPRESS_ZLIB;
+                               btrfs_set_opt(info->mount_opt, COMPRESS);
                        } else if (strcmp(args[0].from, "lzo") == 0) {
                                compress_type = "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 {
                                ret = -EINVAL;
                                goto out;
                        }
 
-                       btrfs_set_opt(info->mount_opt, COMPRESS);
                        if (compress_force) {
                                btrfs_set_opt(info->mount_opt, FORCE_COMPRESS);
                                pr_info("btrfs: force %s compression\n",