zbd: Fix I/O direction adjustment step for random read/write
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 16 Apr 2020 11:30:36 +0000 (20:30 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 17 Apr 2020 14:32:15 +0000 (08:32 -0600)
commitc65057f93d1de62a48f98578e24716128ce77a75
treeaa4b0e1fb0e689a8fdd32585c5b211363a0ad23c
parent8dbd327fbaa267eef862843a270fac61d06df00b
zbd: Fix I/O direction adjustment step for random read/write

Commit fb0259fb ("zbd: Ensure first I/O is write for random read/write to
sequential zones") introduced a step to change direction of io_u from
read to write when that is the first I/O of the random read/write
workload to zoned block devices. However, such direction adjustment
results in inconsistent I/O length when read block size and write block
size are different.

To avoid the inconsistency between I/O direction and I/O length,
adjust the I/O direction before the I/O length is set. Move the step
from zbd_adjust_block() to set_rw_ddir(). To minimize changes in
set_rw_ddir(), introduce zbd_adjust_ddir() helper function.

Fixes: fb0259fb ("zbd: Ensure first I/O is write for random read/write to sequential zones")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c
zbd.c
zbd.h