diff options
Diffstat (limited to 'fs/btrfs/super.c')
| -rw-r--r-- | fs/btrfs/super.c | 30 | 
1 files changed, 23 insertions, 7 deletions
| diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 5a9dc31d95c9..e529ddb35b87 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -517,6 +517,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,  	char *compress_type;  	bool compress_force = false;  	enum btrfs_compression_type saved_compress_type; +	int saved_compress_level;  	bool saved_compress_force;  	int no_compress = 0; @@ -598,6 +599,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,  				info->compress_type : BTRFS_COMPRESS_NONE;  			saved_compress_force =  				btrfs_test_opt(info, FORCE_COMPRESS); +			saved_compress_level = info->compress_level;  			if (token == Opt_compress ||  			    token == Opt_compress_force ||  			    strncmp(args[0].from, "zlib", 4) == 0) { @@ -642,6 +644,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,  				no_compress = 0;  			} else if (strncmp(args[0].from, "no", 2) == 0) {  				compress_type = "no"; +				info->compress_level = 0; +				info->compress_type = 0;  				btrfs_clear_opt(info->mount_opt, COMPRESS);  				btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);  				compress_force = false; @@ -662,11 +666,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,  				 */  				btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);  			} -			if ((btrfs_test_opt(info, COMPRESS) && -			     (info->compress_type != saved_compress_type || -			      compress_force != saved_compress_force)) || -			    (!btrfs_test_opt(info, COMPRESS) && -			     no_compress == 1)) { +			if (no_compress == 1) { +				btrfs_info(info, "use no compression"); +			} else if ((info->compress_type != saved_compress_type) || +				   (compress_force != saved_compress_force) || +				   (info->compress_level != saved_compress_level)) {  				btrfs_info(info, "%s %s compression, level %d",  					   (compress_force) ? "force" : "use",  					   compress_type, info->compress_level); @@ -1382,6 +1386,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)  {  	struct btrfs_fs_info *info = btrfs_sb(dentry->d_sb);  	const char *compress_type; +	const char *subvol_name;  	if (btrfs_test_opt(info, DEGRADED))  		seq_puts(seq, ",degraded"); @@ -1468,8 +1473,13 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)  		seq_puts(seq, ",ref_verify");  	seq_printf(seq, ",subvolid=%llu",  		  BTRFS_I(d_inode(dentry))->root->root_key.objectid); -	seq_puts(seq, ",subvol="); -	seq_dentry(seq, dentry, " \t\n\\"); +	subvol_name = btrfs_get_subvol_name_from_objectid(info, +			BTRFS_I(d_inode(dentry))->root->root_key.objectid); +	if (!IS_ERR(subvol_name)) { +		seq_puts(seq, ",subvol="); +		seq_escape(seq, subvol_name, " \t\n\\"); +		kfree(subvol_name); +	}  	return 0;  } @@ -1950,6 +1960,12 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)  		set_bit(BTRFS_FS_OPEN, &fs_info->flags);  	}  out: +	/* +	 * We need to set SB_I_VERSION here otherwise it'll get cleared by VFS, +	 * since the absence of the flag means it can be toggled off by remount. +	 */ +	*flags |= SB_I_VERSION; +  	wake_up_process(fs_info->transaction_kthread);  	btrfs_remount_cleanup(fs_info, old_opts);  	clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); | 
