summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorYangtao Li <frank.li@vivo.com>2023-03-19 08:51:30 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2023-04-04 22:57:29 +0200
commitd4998b7895ab3a590bcf85f08033166ee9502b03 (patch)
treed3c8a9ce3467c8cfc016dc0af3b142837a059c4e /fs/f2fs
parentf2fs: convert is_extension_exist() to return bool type (diff)
downloadlinux-d4998b7895ab3a590bcf85f08033166ee9502b03.tar.xz
linux-d4998b7895ab3a590bcf85f08033166ee9502b03.zip
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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/super.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 50d23dcc33fb..7d0202f7b317 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1179,9 +1179,17 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
kfree(name);
break;
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;
break;
case Opt_compress_mode:
+ if (!f2fs_sb_has_compression(sbi)) {
+ f2fs_info(sbi, "Image doesn't support compression");
+ break;
+ }
name = match_strdup(&args[0]);
if (!name)
return -ENOMEM;
@@ -1196,6 +1204,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
kfree(name);
break;
case Opt_compress_cache:
+ if (!f2fs_sb_has_compression(sbi)) {
+ f2fs_info(sbi, "Image doesn't support compression");
+ break;
+ }
set_opt(sbi, COMPRESS_CACHE);
break;
#else