From d1ece0c725b4643bcc0187e99b29e7886fc9705a Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 7 Mar 2012 09:32:58 +0100 Subject: [PATCH] Fix batch mismatch for verifies If we set verify_backlog=32, we expect 32 writes followed by 32 reads that verify the written data. But if we fail getting a verify io_u, then we may decrement the batch counter when we should not. The result is that we write 32, read 32, write 1, read 1, repeat. Signed-off-by: Jens Axboe --- io_u.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/io_u.c b/io_u.c index 2deb5c72..06ca711b 100644 --- a/io_u.c +++ b/io_u.c @@ -1117,10 +1117,9 @@ static int check_get_verify(struct thread_data *td, struct io_u *io_u) if (td->o.verify_backlog && td->io_hist_len) { int get_verify = 0; - if (td->verify_batch) { - td->verify_batch--; + if (td->verify_batch) get_verify = 1; - } else if (!(td->io_hist_len % td->o.verify_backlog) && + else if (!(td->io_hist_len % td->o.verify_backlog) && td->last_ddir != DDIR_READ) { td->verify_batch = td->o.verify_batch; if (!td->verify_batch) @@ -1128,8 +1127,10 @@ static int check_get_verify(struct thread_data *td, struct io_u *io_u) get_verify = 1; } - if (get_verify && !get_next_verify(td, io_u)) + if (get_verify && !get_next_verify(td, io_u)) { + td->verify_batch--; return 1; + } } return 0; -- 2.25.1