diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2023-06-12 21:58:34 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2023-06-26 15:07:09 +0200 |
commit | 00e120b5e4b5638cf19eee96d4332f2d100746ba (patch) | |
tree | 80c3f4c7402157468fc215ba70b6ca7d484a16ff /fs/f2fs/super.c | |
parent | f2fs: introduce F2FS_QUOTA_DEFAULT_FL for cleanup (diff) | |
download | linux-00e120b5e4b5638cf19eee96d4332f2d100746ba.tar.xz linux-00e120b5e4b5638cf19eee96d4332f2d100746ba.zip |
f2fs: assign default compression level
Let's avoid any confusion from assigning compress_level=0 for LZ4HC and ZSTD.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | fs/f2fs/super.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8efbb2e1b8b1..a3695adad3d3 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -589,14 +589,12 @@ static int f2fs_set_lz4hc_level(struct f2fs_sb_info *sbi, const char *str) { #ifdef CONFIG_F2FS_FS_LZ4HC unsigned int level; -#endif if (strlen(str) == 3) { - F2FS_OPTION(sbi).compress_level = 0; + F2FS_OPTION(sbi).compress_level = LZ4HC_DEFAULT_CLEVEL; return 0; } -#ifdef CONFIG_F2FS_FS_LZ4HC str += 3; if (str[0] != ':') { @@ -614,6 +612,10 @@ static int f2fs_set_lz4hc_level(struct f2fs_sb_info *sbi, const char *str) F2FS_OPTION(sbi).compress_level = level; return 0; #else + if (strlen(str) == 3) { + F2FS_OPTION(sbi).compress_level = 0; + return 0; + } f2fs_info(sbi, "kernel doesn't support lz4hc compression"); return -EINVAL; #endif @@ -627,7 +629,7 @@ static int f2fs_set_zstd_level(struct f2fs_sb_info *sbi, const char *str) int len = 4; if (strlen(str) == len) { - F2FS_OPTION(sbi).compress_level = 0; + F2FS_OPTION(sbi).compress_level = F2FS_ZSTD_DEFAULT_CLEVEL; return 0; } @@ -640,7 +642,7 @@ static int f2fs_set_zstd_level(struct f2fs_sb_info *sbi, const char *str) if (kstrtouint(str + 1, 10, &level)) return -EINVAL; - if (!level || level > zstd_max_clevel()) { + if (level < zstd_min_clevel() || level > zstd_max_clevel()) { f2fs_info(sbi, "invalid zstd compress level: %d", level); return -EINVAL; } |