diff options
author | Andrei Popa <andrei.popa@i-neo.ro> | 2012-09-20 10:42:11 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-09 09:20:03 -0400 |
commit | bedb2cca7252d08c6ca3085826e30f65bdc3b54b (patch) | |
tree | c4ce295d803c5f862c678a2ee504dbedbfe95a6e /fs/btrfs/super.c | |
parent | 489406626c42c0176fddae2182d33be2cfb9840c (diff) |
Btrfs: make compress and nodatacow mount options mutually exclusive
If a filesystem is mounted with compression and then remounted by adding nodatacow,
the compression is disabled but the compress flag is still visible.
Also, if a filesystem is mounted with nodatacow and then remounted with compression,
nodatacow flag is still present but it's not active.
This patch:
- removes compress flags and notifies that the compression has been disabled if the
filesystem is mounted with nodatacow
- removes nodatacow and nodatasum flags if mounted with compress.
Signed-off-by: Andrei Popa <andrei.popa@i-neo.ro>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 0fadcdba8ce4..915ac14c2064 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -413,7 +413,15 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
413 | btrfs_set_opt(info->mount_opt, NODATASUM); | 413 | btrfs_set_opt(info->mount_opt, NODATASUM); |
414 | break; | 414 | break; |
415 | case Opt_nodatacow: | 415 | case Opt_nodatacow: |
416 | printk(KERN_INFO "btrfs: setting nodatacow\n"); | 416 | if (!btrfs_test_opt(root, COMPRESS) || |
417 | !btrfs_test_opt(root, FORCE_COMPRESS)) { | ||
418 | printk(KERN_INFO "btrfs: setting nodatacow, compression disabled\n"); | ||
419 | } else { | ||
420 | printk(KERN_INFO "btrfs: setting nodatacow\n"); | ||
421 | } | ||
422 | info->compress_type = BTRFS_COMPRESS_NONE; | ||
423 | btrfs_clear_opt(info->mount_opt, COMPRESS); | ||
424 | btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); | ||
417 | btrfs_set_opt(info->mount_opt, NODATACOW); | 425 | btrfs_set_opt(info->mount_opt, NODATACOW); |
418 | btrfs_set_opt(info->mount_opt, NODATASUM); | 426 | btrfs_set_opt(info->mount_opt, NODATASUM); |
419 | break; | 427 | break; |
@@ -428,10 +436,14 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
428 | compress_type = "zlib"; | 436 | compress_type = "zlib"; |
429 | info->compress_type = BTRFS_COMPRESS_ZLIB; | 437 | info->compress_type = BTRFS_COMPRESS_ZLIB; |
430 | btrfs_set_opt(info->mount_opt, COMPRESS); | 438 | btrfs_set_opt(info->mount_opt, COMPRESS); |
439 | btrfs_clear_opt(info->mount_opt, NODATACOW); | ||
440 | btrfs_clear_opt(info->mount_opt, NODATASUM); | ||
431 | } else if (strcmp(args[0].from, "lzo") == 0) { | 441 | } else if (strcmp(args[0].from, "lzo") == 0) { |
432 | compress_type = "lzo"; | 442 | compress_type = "lzo"; |
433 | info->compress_type = BTRFS_COMPRESS_LZO; | 443 | info->compress_type = BTRFS_COMPRESS_LZO; |
434 | btrfs_set_opt(info->mount_opt, COMPRESS); | 444 | btrfs_set_opt(info->mount_opt, COMPRESS); |
445 | btrfs_clear_opt(info->mount_opt, NODATACOW); | ||
446 | btrfs_clear_opt(info->mount_opt, NODATASUM); | ||
435 | btrfs_set_fs_incompat(info, COMPRESS_LZO); | 447 | btrfs_set_fs_incompat(info, COMPRESS_LZO); |
436 | } else if (strncmp(args[0].from, "no", 2) == 0) { | 448 | } else if (strncmp(args[0].from, "no", 2) == 0) { |
437 | compress_type = "no"; | 449 | compress_type = "no"; |