Skip to content

Commit d4998b7

Browse files
bbkzzJaegeuk Kim
authored andcommitted
f2fs: add compression feature check for all compress mount opt
Opt_compress_chksum, Opt_compress_mode and Opt_compress_cache lack the necessary check to see if the image supports compression, let's add it. Signed-off-by: Yangtao Li <frank.li@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent c0abbdf commit d4998b7

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

fs/f2fs/super.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,9 +1179,17 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
11791179
kfree(name);
11801180
break;
11811181
case Opt_compress_chksum:
1182+
if (!f2fs_sb_has_compression(sbi)) {
1183+
f2fs_info(sbi, "Image doesn't support compression");
1184+
break;
1185+
}
11821186
F2FS_OPTION(sbi).compress_chksum = true;
11831187
break;
11841188
case Opt_compress_mode:
1189+
if (!f2fs_sb_has_compression(sbi)) {
1190+
f2fs_info(sbi, "Image doesn't support compression");
1191+
break;
1192+
}
11851193
name = match_strdup(&args[0]);
11861194
if (!name)
11871195
return -ENOMEM;
@@ -1196,6 +1204,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
11961204
kfree(name);
11971205
break;
11981206
case Opt_compress_cache:
1207+
if (!f2fs_sb_has_compression(sbi)) {
1208+
f2fs_info(sbi, "Image doesn't support compression");
1209+
break;
1210+
}
11991211
set_opt(sbi, COMPRESS_CACHE);
12001212
break;
12011213
#else

0 commit comments

Comments
 (0)