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)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 27 Feb 2024 17:41:15 +0000 (09:41 -0800)
commite39602da752cd1d0462e3fa04074146f6f2803f6
tree57aaccdd61f77913d3cfeadaaaaf76b9baa22a61
parent1ff61a3205185e4a7b61a9fb9ab1add1731f662b
f2fs: compress: fix to check zstd compress level correctly in mount option

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>
fs/f2fs/super.c