This patch may will make random write bench score reduce a lot. In my test, use fio test randwrite, config as below: [global] direct=1 numjobs=1 time_based runtime=60 ioengine=sync iodepth=16 filename=fio-test buffer_pattern=0x000000
[file5] name=fio-rand-write rw=randwrite bs=4K size=128M w/o patch: WRITE: bw=12.5MiB/s (13.1MB/s), 12.5MiB/s-12.5MiB/s (13.1MB/s-13.1MB/s), io=750MiB (787MB), run=60001-60001msec w/ patch: WRITE: bw=5823KiB/s (5963kB/s), 5823KiB/s-5823KiB/s (5963kB/s-5963kB/s), io=341MiB (358MB), run=60001-60001msec > -----Original Message----- > From: 常凤楠 > Sent: Monday, October 11, 2021 8:04 PM > To: [email protected]; [email protected] > Cc: [email protected]; 常凤楠 > <[email protected]> > Subject: [PATCH] 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 <[email protected]> > --- > fs/f2fs/data.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index f4fd6c246c9a..267db5d3993e > 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -3025,6 +3025,9 @@ static int f2fs_write_cache_pages(struct > address_space *mapping, > 1)) { > retry = 1; > break; > + } else if (ret2 && nr_pages - i < > cc.cluster_size) { > + retry = 1; > + break; > } > } else { > goto lock_page; > -- > 2.32.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
