From: Jens Axboe Date: Mon, 26 Feb 2007 11:43:42 +0000 (+0100) Subject: Do proper wait for pending IO on clean exit X-Git-Tag: fio-1.12~7 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=c01c03958c2e1d3c231da93f2de8bf7b9b19d143;ds=sidebyside Do proper wait for pending IO on clean exit Only do the cancel if something went wrong and td->error is set, otherwise be a good citizen and complete and account for the io we submitted. Signed-off-by: Jens Axboe --- diff --git a/fio.c b/fio.c index 74604929..b095527e 100644 --- a/fio.c +++ b/fio.c @@ -337,7 +337,12 @@ requeue: break; } - if (td->cur_depth) + if (!td->error) { + min_events = td->cur_depth; + + if (min_events) + ret = io_u_queued_complete(td, min_events); + } else cleanup_pending_aio(td); td_set_runstate(td, TD_RUNNING); @@ -499,15 +504,17 @@ requeue: if (!td->error) { struct fio_file *f; - if (td->cur_depth) - cleanup_pending_aio(td); + i = td->cur_depth; + if (i) + ret = io_u_queued_complete(td, i); if (should_fsync(td) && td->end_fsync) { td_set_runstate(td, TD_FSYNCING); for_each_file(td, f, i) fio_io_sync(td, f); } - } + } else + cleanup_pending_aio(td); } static void cleanup_io_u(struct thread_data *td)