Add some support for a verify backlog

Instead of writing everything and then verifying everything,
allow a job to specify incremental verify stages. This can
help reduce memory consumption of fio, since we don't have
to store a huge number of verify entries to be processed
when the write phase is complete.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
diff --git a/io_u.c b/io_u.c
index 23037f1..76ad933 100644
--- a/io_u.c
+++ b/io_u.c
@@ -926,6 +926,22 @@
 		return NULL;
 	}
 
+	if (td->o.verify_backlog && td->io_hist_len) {
+		int get_verify = 0;
+
+		if (td->verify_batch) {
+			td->verify_batch--;
+			get_verify = 1;
+		} else if (!(td->io_hist_len % td->o.verify_backlog) &&
+			 td->last_ddir != DDIR_READ) {
+			td->verify_batch = td->o.verify_batch;
+			get_verify = 1;
+		}
+
+		if (get_verify && !get_next_verify(td, io_u))
+			goto out;
+	}
+
 	/*
 	 * from a requeue, io_u already setup
 	 */
@@ -1024,6 +1040,7 @@
 	}
 
 	td->last_was_sync = 0;
+	td->last_ddir = io_u->ddir;
 
 	if (!io_u->error) {
 		unsigned int bytes = io_u->buflen - io_u->resid;