Fix bug that causes early termination of fio with verify_backlog
authorJens Axboe <axboe@kernel.dk>
Wed, 7 Mar 2012 08:24:05 +0000 (09:24 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 Mar 2012 08:24:05 +0000 (09:24 +0100)
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>
backend.c

index f3f103038474e3c7e19bd2ece97203080bdab857..814d244cadf241028efdf268692201ce6c9a84aa 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -526,6 +526,20 @@ sync_done:
        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 @@ static void do_io(struct thread_data *td)
        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;