zbd: avoid write with rwmixwrite=0 option
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 20 Dec 2023 00:58:45 +0000 (09:58 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 20 Dec 2023 02:52:35 +0000 (19:52 -0700)
Since the commit fb0259fb276a ("zbd: Ensure first I/O is write for
random read/write to sequential zones"), fio issues write as the first
I/O when zonemode=zbd and rw=randrw options are specified. However, fio
issues the first write even when rwmixwrite=0 option is specified. Users
do not expect such write and it confuses the users. To avoid the
confusion, suppress the write by referring td->o.rwmix[DDIR_WRITE].

Fixes: fb0259fb276a ("zbd: Ensure first I/O is write for random read/write to sequential zones")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20231220005846.1371456-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c

diff --git a/zbd.c b/zbd.c
index c4f7b12f75aaa67ed6fb4f9c369b88d042a1e24b..61b5b688ca9aba5df7f9103590da914be6786d03 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -1876,7 +1876,8 @@ 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->last_start[DDIR_WRITE] != -1ULL || td->o.read_beyond_wp)
+       if (io_u->file->last_start[DDIR_WRITE] != -1ULL ||
+           td->o.read_beyond_wp || td->o.rwmix[DDIR_WRITE] == 0)
                return DDIR_READ;
 
        return DDIR_WRITE;