mirror of https://gitee.com/openkylin/linux.git
f2fs: compress: disable compression mount option if compression is off
If CONFIG_F2FS_FS_COMPRESSION is off, don't allow to configure or show compression related mount option. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
a86d27dd3d
commit
1f0b067b6e
|
@ -460,9 +460,12 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
|
||||||
{
|
{
|
||||||
struct f2fs_sb_info *sbi = F2FS_SB(sb);
|
struct f2fs_sb_info *sbi = F2FS_SB(sb);
|
||||||
substring_t args[MAX_OPT_ARGS];
|
substring_t args[MAX_OPT_ARGS];
|
||||||
|
#ifdef CONFIG_F2FS_FS_COMPRESSION
|
||||||
unsigned char (*ext)[F2FS_EXTENSION_LEN];
|
unsigned char (*ext)[F2FS_EXTENSION_LEN];
|
||||||
|
int ext_cnt;
|
||||||
|
#endif
|
||||||
char *p, *name;
|
char *p, *name;
|
||||||
int arg = 0, ext_cnt;
|
int arg = 0;
|
||||||
kuid_t uid;
|
kuid_t uid;
|
||||||
kgid_t gid;
|
kgid_t gid;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -853,6 +856,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
|
||||||
case Opt_checkpoint_enable:
|
case Opt_checkpoint_enable:
|
||||||
clear_opt(sbi, DISABLE_CHECKPOINT);
|
clear_opt(sbi, DISABLE_CHECKPOINT);
|
||||||
break;
|
break;
|
||||||
|
#ifdef CONFIG_F2FS_FS_COMPRESSION
|
||||||
case Opt_compress_algorithm:
|
case Opt_compress_algorithm:
|
||||||
if (!f2fs_sb_has_compression(sbi)) {
|
if (!f2fs_sb_has_compression(sbi)) {
|
||||||
f2fs_err(sbi, "Compression feature if off");
|
f2fs_err(sbi, "Compression feature if off");
|
||||||
|
@ -918,6 +922,13 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
|
||||||
F2FS_OPTION(sbi).compress_ext_cnt++;
|
F2FS_OPTION(sbi).compress_ext_cnt++;
|
||||||
kfree(name);
|
kfree(name);
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
case Opt_compress_algorithm:
|
||||||
|
case Opt_compress_log_size:
|
||||||
|
case Opt_compress_extension:
|
||||||
|
f2fs_info(sbi, "compression options not supported");
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
f2fs_err(sbi, "Unrecognized mount option \"%s\" or missing value",
|
f2fs_err(sbi, "Unrecognized mount option \"%s\" or missing value",
|
||||||
p);
|
p);
|
||||||
|
@ -1608,7 +1619,9 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
|
||||||
else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER)
|
else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER)
|
||||||
seq_printf(seq, ",fsync_mode=%s", "nobarrier");
|
seq_printf(seq, ",fsync_mode=%s", "nobarrier");
|
||||||
|
|
||||||
|
#ifdef CONFIG_F2FS_FS_COMPRESSION
|
||||||
f2fs_show_compress_options(seq, sbi->sb);
|
f2fs_show_compress_options(seq, sbi->sb);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue