Commit d4998b78 authored by Yangtao Li's avatar Yangtao Li Committed by Jaegeuk Kim

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: default avatarYangtao Li <frank.li@vivo.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent c0abbdf2
...@@ -1179,9 +1179,17 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) ...@@ -1179,9 +1179,17 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
kfree(name); kfree(name);
break; break;
case Opt_compress_chksum: case Opt_compress_chksum:
if (!f2fs_sb_has_compression(sbi)) {
f2fs_info(sbi, "Image doesn't support compression");
break;
}
F2FS_OPTION(sbi).compress_chksum = true; F2FS_OPTION(sbi).compress_chksum = true;
break; break;
case Opt_compress_mode: case Opt_compress_mode:
if (!f2fs_sb_has_compression(sbi)) {
f2fs_info(sbi, "Image doesn't support compression");
break;
}
name = match_strdup(&args[0]); name = match_strdup(&args[0]);
if (!name) if (!name)
return -ENOMEM; return -ENOMEM;
...@@ -1196,6 +1204,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) ...@@ -1196,6 +1204,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
kfree(name); kfree(name);
break; break;
case Opt_compress_cache: case Opt_compress_cache:
if (!f2fs_sb_has_compression(sbi)) {
f2fs_info(sbi, "Image doesn't support compression");
break;
}
set_opt(sbi, COMPRESS_CACHE); set_opt(sbi, COMPRESS_CACHE);
break; break;
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment