Fix verify_backlog start verification before finish writing
authorPuthikorn Voravootivat <puthik@chromium.org>
Wed, 5 Feb 2014 18:28:15 +0000 (10:28 -0800)
committerJens Axboe <axboe@fb.com>
Wed, 5 Feb 2014 19:36:42 +0000 (12:36 -0700)
Due to recent fix for checking rand_seed in verify phase. In write phase,
the IO transaction will be logged before completing the actual data write.
If verify_backlog is enabled, verification may start before all data has
been written. This patch disable that fix if the verify_backlog is enabled.

Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c
io_u.c

index 3ac72e771cb9eaa44a17fabe70d9aee718ccd6a5..8450957543ed2c466a2de78029f01538cfd39f2e 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -718,10 +718,15 @@ static uint64_t do_io(struct thread_data *td)
                else
                        td_set_runstate(td, TD_RUNNING);
 
                else
                        td_set_runstate(td, TD_RUNNING);
 
+               /*
+                * Verify_backlog disabled: We need to log rand seed before the
+                * actual IO to be able to replay it correctly in the verify phase.
+                */
                if (td_write(td) && io_u->ddir == DDIR_WRITE &&
                    td->o.do_verify &&
                    td->o.verify != VERIFY_NONE &&
                if (td_write(td) && io_u->ddir == DDIR_WRITE &&
                    td->o.do_verify &&
                    td->o.verify != VERIFY_NONE &&
-                   !td->o.experimental_verify)
+                   !td->o.experimental_verify &&
+                   !(td->flags & TD_F_VER_BACKLOG))
                        log_io_piece(td, io_u);
 
                ret = td_io_queue(td, io_u);
                        log_io_piece(td, io_u);
 
                ret = td_io_queue(td, io_u);
diff --git a/io_u.c b/io_u.c
index f68b2139ef8de06d6946b8e3fbed208dc0691a55..4264cd54115ca39e2e70d97857179f009d24b742 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1623,6 +1623,17 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                                         utime_since_now(&td->start));
                }
 
                                         utime_since_now(&td->start));
                }
 
+               /*
+                * Verify_backlog enable: We need to log the write job after
+                * finishing it to prevent verifying before finish writing.
+                */
+               if (td_write(td) && idx == DDIR_WRITE &&
+                   td->o.do_verify &&
+                   td->o.verify != VERIFY_NONE &&
+                   !td->o.experimental_verify &&
+                   (td->flags & TD_F_VER_BACKLOG))
+                       log_io_piece(td, io_u);
+
                icd->bytes_done[idx] += bytes;
 
                if (io_u->end_io) {
                icd->bytes_done[idx] += bytes;
 
                if (io_u->end_io) {