X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=backend.c;h=7343286d53219b0c8d4e8a44ec586f1cd66ac6b8;hp=f3f103038474e3c7e19bd2ece97203080bdab857;hb=0fd18982b864987b59dc7bb1e7263a5a8fd73b02;hpb=9c42684e32325da26e862280388798343c5f1305 diff --git a/backend.c b/backend.c index f3f10303..7343286d 100644 --- 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; @@ -573,11 +586,12 @@ static void do_io(struct thread_data *td) ddir = io_u->ddir; /* - * Add verification end_io handler, if asked to verify - * a previously written file. + * Add verification end_io handler if: + * - Asked to verify (!td_rw(td)) + * - Or the io_u is from our verify list (mixed write/ver) */ if (td->o.verify != VERIFY_NONE && io_u->ddir == DDIR_READ && - !td_rw(td)) { + ((io_u->flags & IO_U_F_VER_LIST) || !td_rw(td))) { if (td->o.verify_async) io_u->end_io = verify_io_u_async; else