From 82af2a7ca1a543b41c003de69d5e3c36860f47d5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 13 Mar 2012 13:45:58 +0100 Subject: [PATCH] Fix failure to verify in mixed read/write workload with backlog If you run a workload like this: fio --rw=randrw --bs=4k --direct=1 --ioengine=libaio --iodepth=32 --verify=meta --verify_backlog=1024 --verify_fatal=1 --name=ver-test --filename=foo --size=1G --verify_pattern=0xaaa Fio ends up never actually verifying the written blocks. This happens because as we generate an entry to be verified, the backend checks whether this is a read/write mixed workload. It then thinks that the READ is just that, a normal READ, when in fact it could be coming from our verify list. Mark such a read as coming from our verify list, so that we know if it's a "normal" read or one generated to verify previously written data. Signed-off-by: Jens Axboe --- backend.c | 7 ++++--- io_u.c | 1 + ioengine.h | 1 + verify.c | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index 814d244c..7343286d 100644 --- a/backend.c +++ b/backend.c @@ -586,11 +586,12 @@ static void do_io(struct thread_data *td) ddir = io_u->ddir; /* - * Add verification end_io handler, if asked to verify - * a previously written file. + * Add verification end_io handler if: + * - Asked to verify (!td_rw(td)) + * - Or the io_u is from our verify list (mixed write/ver) */ if (td->o.verify != VERIFY_NONE && io_u->ddir == DDIR_READ && - !td_rw(td)) { + ((io_u->flags & IO_U_F_VER_LIST) || !td_rw(td))) { if (td->o.verify_async) io_u->end_io = verify_io_u_async; else diff --git a/io_u.c b/io_u.c index a0020d27..20794c38 100644 --- a/io_u.c +++ b/io_u.c @@ -1070,6 +1070,7 @@ again: assert(io_u->flags & IO_U_F_FREE); io_u->flags &= ~(IO_U_F_FREE | IO_U_F_FREE_DEF); io_u->flags &= ~(IO_U_F_TRIMMED | IO_U_F_BARRIER); + io_u->flags &= ~IO_U_F_VER_LIST; io_u->error = 0; flist_del(&io_u->list); diff --git a/ioengine.h b/ioengine.h index efca45e2..61cb396f 100644 --- a/ioengine.h +++ b/ioengine.h @@ -11,6 +11,7 @@ enum { IO_U_F_BUSY_OK = 1 << 4, IO_U_F_TRIMMED = 1 << 5, IO_U_F_BARRIER = 1 << 6, + IO_U_F_VER_LIST = 1 << 7, }; /* diff --git a/verify.c b/verify.c index 6dd7f6a0..f25eab92 100644 --- a/verify.c +++ b/verify.c @@ -973,6 +973,7 @@ int get_next_verify(struct thread_data *td, struct io_u *io_u) io_u->offset = ipo->offset; io_u->buflen = ipo->len; io_u->file = ipo->file; + io_u->flags |= IO_U_F_VER_LIST; if (ipo->flags & IP_F_TRIMMED) io_u->flags |= IO_U_F_TRIMMED; -- 2.25.1