From: Shin'ichiro Kawasaki Date: Mon, 13 Apr 2020 08:33:00 +0000 (+0900) Subject: zbd: Ensure first I/O is write for random read/write to sequential zones X-Git-Tag: fio-3.20~31 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=fb0259fb276a5141f957a6521c019f2c8bc71046;p=fio.git zbd: Ensure first I/O is write for random read/write to sequential zones In case read is chosen for the first random I/O for sequential write required zones, fio stops because no data can be read from the zones with empty status. Enforce to write at the first I/O to make sure data to read exists for the following read operations. The unexpected fio stop symptom was observed with test case #30 of t/zbd/test-zbd-support. When the test case was run repeatedly resetting all zones with -r option, it often passes with too short run time. Reviewed-by: Damien Le Moal Signed-off-by: Shin'ichiro Kawasaki Signed-off-by: Jens Axboe --- diff --git a/zbd.c b/zbd.c index aa1fa33f..99ac72ca 100644 --- a/zbd.c +++ b/zbd.c @@ -1350,6 +1350,16 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u) if (!zbd_zone_swr(zb)) return io_u_accept; + /* + * In case read direction is chosen for the first random I/O, fio with + * zonemode=zbd stops because no data can be read from zoned block + * devices with all empty zones. Overwrite the first I/O direction as + * write to make sure data to read exists. + */ + if (td_rw(td) && !f->zbd_info->sectors_with_data + && !td->o.read_beyond_wp) + io_u->ddir = DDIR_WRITE; + /* * Accept the I/O offset for reads if reading beyond the write pointer * is enabled.