From c01c03958c2e1d3c231da93f2de8bf7b9b19d143 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 26 Feb 2007 12:43:42 +0100 Subject: [PATCH] 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 --- fio.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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) -- 2.25.1