Revert "ioengines.c:346: td_io_queue: Assertion `res == 0' failed"
[fio.git] / backend.c
index cb1fbf424136d03de69774d0b36112c5789857a7..975ef48938c2badc50bed84d276ffc5c8f348f1e 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -637,15 +637,6 @@ static void do_verify(struct thread_data *td, uint64_t verify_bytes)
        if (td->error)
                return;
 
-       /*
-        * verify_state needs to be reset before verification
-        * proceeds so that expected random seeds match actual
-        * random seeds in headers. The main loop will reset
-        * all random number generators if randrepeat is set.
-        */
-       if (!td->o.rand_repeatable)
-               td_fill_verify_state_seed(td);
-
        td_set_runstate(td, TD_VERIFYING);
 
        io_u = NULL;
@@ -1049,8 +1040,11 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
                }
 
                if (io_u->ddir == DDIR_WRITE && td->flags & TD_F_DO_VERIFY) {
-                       io_u->numberio = td->io_issues[io_u->ddir];
-                       populate_verify_io_u(td, io_u);
+                       if (!(io_u->flags & IO_U_F_PATTERN_DONE)) {
+                               io_u_set(td, io_u, IO_U_F_PATTERN_DONE);
+                               io_u->numberio = td->io_issues[io_u->ddir];
+                               populate_verify_io_u(td, io_u);
+                       }
                }
 
                ddir = io_u->ddir;
@@ -1894,8 +1888,12 @@ static void *thread_main(void *data)
                if (td->o.verify_only && td_write(td))
                        verify_bytes = do_dry_run(td);
                else {
+                       if (!td->o.rand_repeatable)
+                               /* save verify rand state to replay hdr seeds later at verify */
+                               frand_copy(&td->verify_state_last_do_io, &td->verify_state);
                        do_io(td, bytes_done);
-
+                       if (!td->o.rand_repeatable)
+                               frand_copy(&td->verify_state, &td->verify_state_last_do_io);
                        if (!ddir_rw_sum(bytes_done)) {
                                fio_mark_td_terminate(td);
                                verify_bytes = 0;