From: Bart Van Assche Date: Mon, 26 Mar 2018 16:00:28 +0000 (-0700) Subject: Only populate the write buffer if necessary X-Git-Tag: fio-3.6~18^2~3 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=5c5c33c1b0df088187a6d4fac5459df5e029763a Only populate the write buffer if necessary 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 --- diff --git a/backend.c b/backend.c index f2d7cc36..b28c3dbc 100644 --- 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 d4a65089..5fbb2386 100644 --- 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