diff options
author | 2023-06-12 11:01:16 +0800 | |
---|---|---|
committer | 2023-06-26 06:07:09 -0700 | |
commit | c571fbb5b59a3741e48014faa92c2f14bc59fe50 (patch) | |
tree | 80ccef93aba61fa59e7a65859fade267a837c3fa /fs/f2fs/super.c | |
parent | f2fs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method (diff) | |
download | linux-c571fbb5b59a3741e48014faa92c2f14bc59fe50.tar.gz linux-c571fbb5b59a3741e48014faa92c2f14bc59fe50.tar.bz2 linux-c571fbb5b59a3741e48014faa92c2f14bc59fe50.zip |
f2fs: add helper to check compression level
This patch adds a helper function to check if compression level is
valid.
Signed-off-by: Sheng Yong <shengyong@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index a3695adad3d3..5b7d25fd4c08 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -604,7 +604,7 @@ static int f2fs_set_lz4hc_level(struct f2fs_sb_info *sbi, const char *str) if (kstrtouint(str + 1, 10, &level)) return -EINVAL; - if (level < LZ4HC_MIN_CLEVEL || level > LZ4HC_MAX_CLEVEL) { + if (!f2fs_is_compress_level_valid(COMPRESS_LZ4, level)) { f2fs_info(sbi, "invalid lz4hc compress level: %d", level); return -EINVAL; } @@ -642,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 < zstd_min_clevel() || level > zstd_max_clevel()) { + if (!f2fs_is_compress_level_valid(COMPRESS_ZSTD, level)) { f2fs_info(sbi, "invalid zstd compress level: %d", level); return -EINVAL; } |