verify: fix loops option behavior of read-verify workloads
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 14 Feb 2024 12:20:07 +0000 (21:20 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 14 Feb 2024 14:39:48 +0000 (07:39 -0700)
commit96a7e64c8967631ac565481672209ce96df02332
tree8897e23cea5d995250f0603bdf333191a7edea60
parenta99bd37f690ab246caa9b9d65adfa65a25967190
verify: fix loops option behavior of read-verify workloads

The commit 191d6634e8a6 ("verify: fix bytes_done accounting of
experimental verify") introduced td->bytes_verified to separate the
verified bytes from the read bytes in td->bytes_done[]. This fixed the
issue of experimental verify feature. However, it caused another issue.
When the verify workload does only read and does not do write, the read
bytes in td->bytes_done[] is no longer updated and always zero. This
zero value is returned from do_io() to thread_main() in the bytes_done
array. If the read bytes is zero, thread_main() marks the job to
terminate and it makes the loops option ignored. For example, the job
below should do 8k read, but it does only 4k read.

[global]
filename=/tmp/fio.test
size=4k
verify=md5

[write]
rw=write
do_verify=0

[read]
stonewall=1
rw=read
loops=2
do_verify=1

To make the loops option work together with the read-verify workloads,
modify io_u_update_bytes_done(). After updating td->bytes_verified,
check if the workload does not write. If so, do not return from
io_u_update_bytes_done() and update td->bytes_done[] for DDIR_READ in
the following code.

Fixes: 191d6634e8a6 ("verify: fix bytes_done accounting of experimental verify")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240214122008.4123286-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c