]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: compress: fix overwrite may reduce compress ratio unproperly
authorFengnan Chang <changfengnan@vivo.com>
Sat, 23 Oct 2021 03:08:00 +0000 (20:08 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 26 Oct 2021 21:04:31 +0000 (14:04 -0700)
commit83a69f945e7898cfd6834481614bba8a50614f6f
treee4164fd66d5fd80b12188b193c662401b220f399
parent159ef2aa42dfc89ae59a2958fb05b3f84594836a
f2fs: compress: fix overwrite may reduce compress ratio unproperly

when overwrite only first block of cluster, since cluster is not full, it
will call f2fs_write_raw_pages when f2fs_write_multi_pages, and cause the
whole cluster become uncompressed eventhough data can be compressed.
this may will make random write bench score reduce a lot.

root# dd if=/dev/zero of=./fio-test bs=1M count=1

root# sync

root# echo 3 > /proc/sys/vm/drop_caches

root# f2fs_io get_cblocks ./fio-test

root# dd if=/dev/zero of=./fio-test bs=4K count=1 oflag=direct conv=notrunc

w/o patch:
root# f2fs_io get_cblocks ./fio-test
189

w/ patch:
root# f2fs_io get_cblocks ./fio-test
192

Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/compress.c
fs/f2fs/data.c
fs/f2fs/f2fs.h