aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2020-12-09 16:43:26 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2021-01-11 01:00:39 -0800
commitec0d0eb347b05377ad2e03c51cb1d08d6ed35619 (patch)
treec5c2f0e25476eeafb1afad2649cc9c60ccab0846
parent0ba061b9e957791e8120b6acb589a26fa7bbbb53 (diff)
downloadlinux-next-ec0d0eb347b05377ad2e03c51cb1d08d6ed35619.tar.gz
f2fs: compress: deny setting unsupported compress algorithm
Notice: this object is not reachable from any branch.
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>
Notice: this object is not reachable from any branch.
-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 bcad64ff5b647..c39c03ac74684 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -934,9 +934,14 @@ 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 (!strncmp(name, "lz4", 3)) {
+#ifdef CONFIG_F2FS_FS_LZ4
ret = f2fs_compress_set_level(sbi, name,
COMPRESS_LZ4);
if (ret) {
@@ -945,7 +950,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
}
F2FS_OPTION(sbi).compress_algorithm =
COMPRESS_LZ4;
+#else
+ f2fs_info(sbi, "kernel doesn't support lz4 compression");
+#endif
} else if (!strncmp(name, "zstd", 4)) {
+#ifdef CONFIG_F2FS_FS_ZSTD
ret = f2fs_compress_set_level(sbi, name,
COMPRESS_ZSTD);
if (ret) {
@@ -954,9 +963,16 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
}
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;