From face81b280ab94ba5d975739578779157c8b54ce Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 26 Feb 2007 10:40:03 +0100 Subject: [PATCH] Move ->commit() call to td_io_getevents() If we need to complete some events (min > 0), make sure we have committed a pending batch. Signed-off-by: Jens Axboe --- io_u.c | 8 +------- ioengines.c | 6 ++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/io_u.c b/io_u.c index 372f46a0..ede61a8e 100644 --- a/io_u.c +++ b/io_u.c @@ -572,13 +572,7 @@ long io_u_queued_complete(struct thread_data *td, int min_events) struct timespec *tvp = NULL; int ret; - if (min_events > 0) { - ret = td_io_commit(td); - if (ret < 0) { - td_verror(td, -ret, "td_io_commit"); - return ret; - } - } else { + if (!min_events) { struct timespec ts = { .tv_sec = 0, .tv_nsec = 0, }; tvp = &ts; diff --git a/ioengines.c b/ioengines.c index 0b3ec164..727981f1 100644 --- a/ioengines.c +++ b/ioengines.c @@ -182,6 +182,12 @@ int td_io_prep(struct thread_data *td, struct io_u *io_u) int td_io_getevents(struct thread_data *td, int min, int max, struct timespec *t) { + if (min > 0 && td->io_ops->commit) { + int r = td->io_ops->commit(td); + + if (r < 0) + return r; + } if (td->io_ops->getevents) return td->io_ops->getevents(td, min, max, t); -- 2.25.1