]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: compress: fix to check zstd compress level correctly in mount option
authorChao Yu <chao@kernel.org>
Mon, 12 Feb 2024 16:08:18 +0000 (00:08 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:20:01 +0000 (18:20 -0400)
commit9deb2010aa9fd92ecb775cf7543fe2facd5e1cd3
treebe6093d07b1a460044246ad82976b628b89b4c21
parent7525dec4b34c80b3015c3f2ac143fd2bfc1febc3
f2fs: compress: fix to check zstd compress level correctly in mount option

[ Upstream commit e39602da752cd1d0462e3fa04074146f6f2803f6 ]

f2fs only support to config zstd compress level w/ a positive number due
to layout design, but since commit e0c1b49f5b67 ("lib: zstd: Upgrade to
latest upstream zstd version 1.4.10"), zstd supports negative compress
level, so that zstd_min_clevel() may return a negative number, then w/
below mount option, .compress_level can be configed w/ a negative number,
which is not allowed to f2fs, let's add check condition to avoid it.

mount -o compress_algorithm=zstd:4294967295 /dev/sdx /mnt/f2fs

Fixes: 00e120b5e4b5 ("f2fs: assign default compression level")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/super.c