aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorGravatar Chao Yu <yuchao0@huawei.com> 2021-01-22 17:40:13 +0800
committerGravatar Jaegeuk Kim <jaegeuk@kernel.org> 2021-01-27 15:20:02 -0800
commit32be0e97c71366a19d11d1965e3f0957ea0be609 (patch)
tree4ecb15d835514794c7a08ee8bd8ff58867c898f4 /fs/f2fs/super.c
parentf2fs: relocate f2fs_precache_extents() (diff)
downloadlinux-32be0e97c71366a19d11d1965e3f0957ea0be609.tar.gz
linux-32be0e97c71366a19d11d1965e3f0957ea0be609.tar.bz2
linux-32be0e97c71366a19d11d1965e3f0957ea0be609.zip
f2fs: compress: deny setting unsupported compress algorithm
If kernel doesn't support certain kinds of compress algorithm, deny to set them as compress algorithm of f2fs via 'compress_algorithm=%s' mount option. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r--fs/f2fs/super.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index b4a07fe62d1a..a275bd312ae5 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -882,17 +882,33 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
if (!name)
return -ENOMEM;
if (!strcmp(name, "lzo")) {
+#ifdef CONFIG_F2FS_FS_LZO
F2FS_OPTION(sbi).compress_algorithm =
COMPRESS_LZO;
+#else
+ f2fs_info(sbi, "kernel doesn't support lzo compression");
+#endif
} else if (!strcmp(name, "lz4")) {
+#ifdef CONFIG_F2FS_FS_LZ4
F2FS_OPTION(sbi).compress_algorithm =
COMPRESS_LZ4;
+#else
+ f2fs_info(sbi, "kernel doesn't support lz4 compression");
+#endif
} else if (!strcmp(name, "zstd")) {
+#ifdef CONFIG_F2FS_FS_ZSTD
F2FS_OPTION(sbi).compress_algorithm =
COMPRESS_ZSTD;
+#else
+ f2fs_info(sbi, "kernel doesn't support zstd compression");
+#endif
} else if (!strcmp(name, "lzo-rle")) {
+#ifdef CONFIG_F2FS_FS_LZORLE
F2FS_OPTION(sbi).compress_algorithm =
COMPRESS_LZORLE;
+#else
+ f2fs_info(sbi, "kernel doesn't support lzorle compression");
+#endif
} else {
kfree(name);
return -EINVAL;