Fix bug that causes early termination of fio with verify_backlog

Running this job:

[global]
bs=4k
ioengine=sync
size=100m
direct=1
filename=xxx

[write]
verify=md5
verify_backlog=32
rw=write

causes fio to exit when reads + writes have exceeded 100m, where
it should only exit when writes have exceeded 100m. Fix this by
checking the appropriate counters based on what type of job it is.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/backend.c b/backend.c
index f3f1030..814d244 100644
--- a/backend.c
+++ b/backend.c
@@ -526,6 +526,20 @@
 	dprint(FD_VERIFY, "exiting loop\n");
 }
 
+static int io_bytes_exceeded(struct thread_data *td)
+{
+	unsigned long long bytes;
+
+	if (td_rw(td))
+		bytes = td->this_io_bytes[0] + td->this_io_bytes[1];
+	else if (td_write(td))
+		bytes = td->this_io_bytes[1];
+	else
+		bytes = td->this_io_bytes[0];
+
+	return bytes >= td->o.size;
+}
+
 /*
  * Main IO worker function. It retrieves io_u's to process and queues
  * and reaps them, checking for rate and errors along the way.
@@ -540,9 +554,8 @@
 	else
 		td_set_runstate(td, TD_RUNNING);
 
-	while ( (td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
-		(!flist_empty(&td->trim_list)) ||
-	        ((td->this_io_bytes[0] + td->this_io_bytes[1]) < td->o.size) ) {
+	while ((td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
+		(!flist_empty(&td->trim_list)) || !io_bytes_exceeded(td)) {
 		struct timeval comp_time;
 		unsigned long bytes_done[2] = { 0, 0 };
 		int min_evts = 0;