mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 13:51:52 +00:00
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>
This commit is contained in:
parent
0b979f1bde
commit
32be0e97c7
1 changed files with 16 additions and 0 deletions
|
@ -882,17 +882,33 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
|
||||||
if (!name)
|
if (!name)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
if (!strcmp(name, "lzo")) {
|
if (!strcmp(name, "lzo")) {
|
||||||
|
#ifdef CONFIG_F2FS_FS_LZO
|
||||||
F2FS_OPTION(sbi).compress_algorithm =
|
F2FS_OPTION(sbi).compress_algorithm =
|
||||||
COMPRESS_LZO;
|
COMPRESS_LZO;
|
||||||
|
#else
|
||||||
|
f2fs_info(sbi, "kernel doesn't support lzo compression");
|
||||||
|
#endif
|
||||||
} else if (!strcmp(name, "lz4")) {
|
} else if (!strcmp(name, "lz4")) {
|
||||||
|
#ifdef CONFIG_F2FS_FS_LZ4
|
||||||
F2FS_OPTION(sbi).compress_algorithm =
|
F2FS_OPTION(sbi).compress_algorithm =
|
||||||
COMPRESS_LZ4;
|
COMPRESS_LZ4;
|
||||||
|
#else
|
||||||
|
f2fs_info(sbi, "kernel doesn't support lz4 compression");
|
||||||
|
#endif
|
||||||
} else if (!strcmp(name, "zstd")) {
|
} else if (!strcmp(name, "zstd")) {
|
||||||
|
#ifdef CONFIG_F2FS_FS_ZSTD
|
||||||
F2FS_OPTION(sbi).compress_algorithm =
|
F2FS_OPTION(sbi).compress_algorithm =
|
||||||
COMPRESS_ZSTD;
|
COMPRESS_ZSTD;
|
||||||
|
#else
|
||||||
|
f2fs_info(sbi, "kernel doesn't support zstd compression");
|
||||||
|
#endif
|
||||||
} else if (!strcmp(name, "lzo-rle")) {
|
} else if (!strcmp(name, "lzo-rle")) {
|
||||||
|
#ifdef CONFIG_F2FS_FS_LZORLE
|
||||||
F2FS_OPTION(sbi).compress_algorithm =
|
F2FS_OPTION(sbi).compress_algorithm =
|
||||||
COMPRESS_LZORLE;
|
COMPRESS_LZORLE;
|
||||||
|
#else
|
||||||
|
f2fs_info(sbi, "kernel doesn't support lzorle compression");
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
kfree(name);
|
kfree(name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue