Only populate the write buffer if necessary
authorBart Van Assche <bart.vanassche@wdc.com>
Mon, 26 Mar 2018 16:00:28 +0000 (09:00 -0700)
committerBart Van Assche <bart.vanassche@wdc.com>
Wed, 4 Apr 2018 20:51:39 +0000 (13:51 -0700)
This patch moves the populate_verify_io_u() call from inside
get_io_u() into all its callers except do_dry_run() and thereby skips
write buffer population for dry runs. This patch does not change the
behavior of fio but is necessary because the ZBC patch will insert
code in fill_io_u() after the get_io_u() call that may modify the
write offset.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
backend.c
io_u.c

index f2d7cc368f0f63534218fc60e13d7ef895b0e3c5..b28c3dbc4fd65fdf71b3ad4581a9b27e9aac7511 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -723,6 +723,7 @@ static void do_verify(struct thread_data *td, uint64_t verify_bytes)
                                        break;
                                } else if (io_u->ddir == DDIR_WRITE) {
                                        io_u->ddir = DDIR_READ;
+                                       populate_verify_io_u(td, io_u);
                                        break;
                                } else {
                                        put_io_u(td, io_u);
@@ -995,6 +996,9 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
                        break;
                }
 
+               if (io_u->ddir == DDIR_WRITE && td->flags & TD_F_DO_VERIFY)
+                       populate_verify_io_u(td, io_u);
+
                ddir = io_u->ddir;
 
                /*
diff --git a/io_u.c b/io_u.c
index d4a65089a502ece5f28d58ef38ad84ae85def358..5fbb2386237de6ba8aa106917e9f222ae564e014 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1699,7 +1699,7 @@ static void small_content_scramble(struct io_u *io_u)
 
 /*
  * Return an io_u to be processed. Gets a buflen and offset, sets direction,
- * etc. The returned io_u is fully ready to be prepped and submitted.
+ * etc. The returned io_u is fully ready to be prepped, populated and submitted.
  */
 struct io_u *get_io_u(struct thread_data *td)
 {
@@ -1760,12 +1760,9 @@ struct io_u *get_io_u(struct thread_data *td)
                                        td->o.min_bs[DDIR_WRITE],
                                        io_u->buflen);
                        } else if ((td->flags & TD_F_SCRAMBLE_BUFFERS) &&
-                                  !(td->flags & TD_F_COMPRESS))
+                                  !(td->flags & TD_F_COMPRESS) &&
+                                  !(td->flags & TD_F_DO_VERIFY))
                                do_scramble = 1;
-                       if (td->flags & TD_F_DO_VERIFY) {
-                               populate_verify_io_u(td, io_u);
-                               do_scramble = 0;
-                       }
                } else if (io_u->ddir == DDIR_READ) {
                        /*
                         * Reset the buf_filled parameters so next time if the