To decide the first IO direction of randrw workload, the function zbd_adjust_ddir() refers to the file zbd_info->sectors_with_data value which indicates the number of sectors written to the zoned block device being accessed. However, the sector with data accounting has two issues. The first issue is vague definition between accounting per job and per device. The second issue is job start up failure due to zone lock contention. Avoid using zbd_info->sectors_with_data and simply refer to file-> last_start[DDIR_WRITE] instead. It is initialized with -1ULL for each job. After any write operation is done by the job, it keeps valid offset. If it has valid offset, written data is expected and the first IO direction can be read. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> --- zbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zbd.c b/zbd.c index d1e469f6..8d8d5747 100644 --- a/zbd.c +++ b/zbd.c @@ -1801,8 +1801,7 @@ enum fio_ddir zbd_adjust_ddir(struct thread_data *td, struct io_u *io_u, if (ddir != DDIR_READ || !td_rw(td)) return ddir; - if (io_u->file->zbd_info->sectors_with_data || - td->o.read_beyond_wp) + if (io_u->file->last_start[DDIR_WRITE] != -1ULL || td->o.read_beyond_wp) return DDIR_READ; return DDIR_WRITE; -- 2.38.1