aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Shilong <[email protected]>2014-06-30 10:51:25 +0800
committerChris Mason <[email protected]>2014-09-17 13:37:19 -0700
commit4027e0f4c4b2df28d564560a3c65c179bebae4c8 (patch)
tree64a0fcf3ad7ee643f9049fcefa52bd22059c461e
parented6078f70335f158ca79790a0d0708ce558a6e9a (diff)
Btrfs: clear compress-force when remounting with compress option
Steps to reproduce: # mkfs.btrfs -f /dev/sdb # mount /dev/sdb /mnt -o compress-force=lzo # mount /dev/sdb /mnt -o remount,compress=zlib # cat /proc/mounts Remounting from compress-force to compress could not clear compress-force option. The problem is there is no way for users to clear compress-force option separately. Fix this problem by clearing @FORCE_COMPRESS flag when remounting to compress=xxx. Suggested-by: Tsutomu Itoh <[email protected]> Signed-off-by: Wang Shilong <[email protected]> Reviewed-by: David Sterba <[email protected]> Reviewed-by: Satoru Takeuchi <[email protected]> Tested-by: Satoru Takeuchi <[email protected]> Signed-off-by: Chris Mason <[email protected]>
-rw-r--r--fs/btrfs/super.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 568ddc16119f..d66fbd57f1b5 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -507,6 +507,13 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
btrfs_info(root->fs_info,
"btrfs: use %s compression",
compress_type);
+ /*
+ * If we remount from compress-force=xxx to
+ * compress=xxx, we need clear FORCE_COMPRESS
+ * flag, otherwise, there is no way for users
+ * to disable forcible compression separately.
+ */
+ btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);
}
break;
case Opt_ssd: