Skip to content

Commit 1f0b067

Browse files
chaseyuJaegeuk Kim
authored andcommitted
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 <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent a86d27d commit 1f0b067

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

fs/f2fs/super.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,12 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
460460
{
461461
struct f2fs_sb_info *sbi = F2FS_SB(sb);
462462
substring_t args[MAX_OPT_ARGS];
463+
#ifdef CONFIG_F2FS_FS_COMPRESSION
463464
unsigned char (*ext)[F2FS_EXTENSION_LEN];
465+
int ext_cnt;
466+
#endif
464467
char *p, *name;
465-
int arg = 0, ext_cnt;
468+
int arg = 0;
466469
kuid_t uid;
467470
kgid_t gid;
468471
int ret;
@@ -853,6 +856,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
853856
case Opt_checkpoint_enable:
854857
clear_opt(sbi, DISABLE_CHECKPOINT);
855858
break;
859+
#ifdef CONFIG_F2FS_FS_COMPRESSION
856860
case Opt_compress_algorithm:
857861
if (!f2fs_sb_has_compression(sbi)) {
858862
f2fs_err(sbi, "Compression feature if off");
@@ -918,6 +922,13 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
918922
F2FS_OPTION(sbi).compress_ext_cnt++;
919923
kfree(name);
920924
break;
925+
#else
926+
case Opt_compress_algorithm:
927+
case Opt_compress_log_size:
928+
case Opt_compress_extension:
929+
f2fs_info(sbi, "compression options not supported");
930+
break;
931+
#endif
921932
default:
922933
f2fs_err(sbi, "Unrecognized mount option \"%s\" or missing value",
923934
p);
@@ -1608,7 +1619,9 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
16081619
else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER)
16091620
seq_printf(seq, ",fsync_mode=%s", "nobarrier");
16101621

1622+
#ifdef CONFIG_F2FS_FS_COMPRESSION
16111623
f2fs_show_compress_options(seq, sbi->sb);
1624+
#endif
16121625
return 0;
16131626
}
16141627

0 commit comments

Comments
 (0)