Message ID | 20230607162954.2651657-1-jaegeuk@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev] f2fs: set zstd default compression level to 3 | expand |
On 2023/6/8 0:29, Jaegeuk Kim wrote: > ZSTD does not support compress_level=0. IIUC, it looks the range is [0, ZSTD_MAX_CLEVEL], 0 equals to default (ZSTD_CLEVEL_DEFAULT). zstd_compress.c /* row */ if (compressionLevel == 0) row = ZSTD_CLEVEL_DEFAULT; /* 0 == default */ else if (compressionLevel < 0) row = 0; /* entry 0 is baseline for fast mode */ else if (compressionLevel > ZSTD_MAX_CLEVEL) row = ZSTD_MAX_CLEVEL; else row = compressionLevel; Thanks, > > The commit d7ffafc99c42 ("f2fs: add sanity compress level check for compressed file") > revealed the issue. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > --- > fs/f2fs/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 8fd23caa1ed9..1fb8d4f27a40 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -627,7 +627,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 = 3; > return 0; > } >
On 06/12, Chao Yu wrote: > On 2023/6/8 0:29, Jaegeuk Kim wrote: > > ZSTD does not support compress_level=0. > > IIUC, it looks the range is [0, ZSTD_MAX_CLEVEL], 0 equals to default > (ZSTD_CLEVEL_DEFAULT). Ok, that seems a quick workaround of zstd, since it'd be quite hard to know level=0 will be interpreted to whatever default behind the scenes. > > zstd_compress.c > > /* row */ > if (compressionLevel == 0) row = ZSTD_CLEVEL_DEFAULT; /* 0 == default */ > else if (compressionLevel < 0) row = 0; /* entry 0 is baseline for fast mode */ > else if (compressionLevel > ZSTD_MAX_CLEVEL) row = ZSTD_MAX_CLEVEL; > else row = compressionLevel; > > Thanks, > > > > > The commit d7ffafc99c42 ("f2fs: add sanity compress level check for compressed file") > > revealed the issue. > > > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > > --- > > fs/f2fs/super.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > > index 8fd23caa1ed9..1fb8d4f27a40 100644 > > --- a/fs/f2fs/super.c > > +++ b/fs/f2fs/super.c > > @@ -627,7 +627,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 = 3; > > return 0; > > }
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8fd23caa1ed9..1fb8d4f27a40 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -627,7 +627,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 = 3; return 0; }
ZSTD does not support compress_level=0. The commit d7ffafc99c42 ("f2fs: add sanity compress level check for compressed file") revealed the issue. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- fs/f2fs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)