From: Jens Axboe Date: Wed, 7 Mar 2012 08:24:05 +0000 (+0100) Subject: Fix bug that causes early termination of fio with verify_backlog X-Git-Tag: fio-2.0.6~21 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=f7078f7b517ace62bdf22967c18525b5b6c68b85;ds=inline 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 --- diff --git a/backend.c b/backend.c index f3f10303..814d244c 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;