diff options
author | Chao Yu <chao@kernel.org> | 2021-07-10 08:21:41 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2021-07-13 16:10:35 -0700 |
commit | 01f6afd0f3ccaa2d5f7fb87e7bd910dc17eef06b (patch) | |
tree | b556535fe67b75da5af24c6bb5604c6f7fa3ba5c /fs/f2fs/f2fs.h | |
parent | 07c6b5933ebf58b6132aea9f3e72a62486882bfb (diff) | |
download | linux-stable-01f6afd0f3ccaa2d5f7fb87e7bd910dc17eef06b.tar.gz linux-stable-01f6afd0f3ccaa2d5f7fb87e7bd910dc17eef06b.tar.bz2 linux-stable-01f6afd0f3ccaa2d5f7fb87e7bd910dc17eef06b.zip |
f2fs: compress: fix to set zstd compress level correctly
As 5kft reported in [1]:
set_compress_context() should set compress level into .i_compress_flag
for zstd as well as lz4hc, otherwise, zstd compressor will still use
default zstd compress level during compression, fix it.
[1] https://lore.kernel.org/linux-f2fs-devel/8e29f52b-6b0d-45ec-9520-e63eb254287a@www.fastmail.com/T/#u
Fixes: 3fde13f817e2 ("f2fs: compress: support compress level")
Reported-by: 5kft <5kft@5kft.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 49d35e27db9f..867f2c5d9559 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4142,7 +4142,8 @@ static inline void set_compress_context(struct inode *inode) 1 << COMPRESS_CHKSUM : 0; F2FS_I(inode)->i_cluster_size = 1 << F2FS_I(inode)->i_log_cluster_size; - if (F2FS_I(inode)->i_compress_algorithm == COMPRESS_LZ4 && + if ((F2FS_I(inode)->i_compress_algorithm == COMPRESS_LZ4 || + F2FS_I(inode)->i_compress_algorithm == COMPRESS_ZSTD) && F2FS_OPTION(sbi).compress_level) F2FS_I(inode)->i_compress_flag |= F2FS_OPTION(sbi).compress_level << |