summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBari Antebi <bari@lightbitslabs.com>2018-11-22 20:14:57 +0200
committerJens Axboe <axboe@kernel.dk>2018-11-29 08:23:19 -0700
commit3363fa4482e24fb87d8aea3443e11d90f1bfc462 (patch)
tree4ba9777e2b4dfc22463fe9b57fcfedc0a706cce1 /lib
parentc36210b443a37c53978bbea88f1dabb0b61799d7 (diff)
downloadfio-3363fa4482e24fb87d8aea3443e11d90f1bfc462.tar.gz
fio-3363fa4482e24fb87d8aea3443e11d90f1bfc462.tar.bz2
rand: fix compressible data ratio per segment
I've noticed a bug in fio while testing it. I expected to receive output similar to the expected output below for: "hexdump -n 4096 /dev/nvme0n1" (considering the configuration file I've used that may be found below). Expected output: 0000000 fdc6 a8a8 7190 0219 1fb8 9632 d9dd 1e64 /* random data */ 00004c0 d8a3 13fe aeec 0fb6 5b14 162e 0000 0000 00004d0 0000 0000 0000 0000 0000 0000 0000 0000 * 0001000 However, the output I've received contained data after address 4cc (which should have been filled with zeroes until 1000 as far as I understand, but as you can see 99a contains data. 0000000 fdc6 a8a8 7190 0219 1fb8 9632 d9dd 1e64 /* random data */ 00004c0 d8a3 13fe aeec 0fb6 5b14 162e 0000 0000 00004d0 0000 0000 0000 0000 0000 0000 0000 0000 * 0000990 0000 0000 0000 0000 fdc6 a8a8 7190 0219 Config file: [global] group_reporting=1 filename=/dev/nvme0n1 name=task_nvme0n1 rw=write bs=4096 numjobs=1 iodepth=32 buffer_compress_chunk=4096 buffer_compress_percentage=70 cpus_allowed=0-8 cpus_allowed_policy=split direct=1 ioengine=libaio loops=1 refill_buffers=0 [job empty] size=4096 Fio should write (100 - compress_percentage) * segemnt of random data followed by compress_percentage * segemnt of compressible data. Currently, at each itereation fio fills (100 - compress_percentage) * segemnt data, followed by (100 - compress_percentage) * segemnt of compressible data until a the segment is filled. Fixes: 811ac503a619 ("Compression fixes") Signed-off-by: Bari Antebi <bari@lightbitslabs.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'lib')
-rw-r--r--lib/rand.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/rand.c b/lib/rand.c
index 99846a8d..f18bd8d8 100644
--- a/lib/rand.c
+++ b/lib/rand.c
@@ -166,6 +166,7 @@ void __fill_random_buf_percentage(unsigned long seed, void *buf,
if (!len)
break;
buf += this_len;
+ this_len = segment - this_len;
if (this_len > len)
this_len = len;