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 <axboe@kernel.dk>
diff --git a/backend.c b/backend.c
index 814d244..7343286 100644
--- a/backend.c
+++ b/backend.c
@@ -586,11 +586,12 @@
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 a0020d2..20794c3 100644
--- a/io_u.c
+++ b/io_u.c
@@ -1070,6 +1070,7 @@
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 efca45e..61cb396 100644
--- a/ioengine.h
+++ b/ioengine.h
@@ -11,6 +11,7 @@
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 6dd7f6a..f25eab9 100644
--- a/verify.c
+++ b/verify.c
@@ -973,6 +973,7 @@
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;