From 0d593542dd59324fa8a6956716a1278732812af2 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 3 Dec 2015 19:58:23 -0700 Subject: [PATCH] io_u: make io_u_quiesce() return how many IOs it completed Ditto for io_u_queued_complete(). Signed-off-by: Jens Axboe --- io_u.c | 10 ++++++++-- ioengine.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/io_u.c b/io_u.c index d45a6f01..f86367bd 100644 --- a/io_u.c +++ b/io_u.c @@ -542,8 +542,10 @@ static inline enum fio_ddir get_rand_ddir(struct thread_data *td) return DDIR_WRITE; } -void io_u_quiesce(struct thread_data *td) +int io_u_quiesce(struct thread_data *td) { + int completed = 0; + /* * We are going to sleep, ensure that we flush anything pending as * not to skew our latency numbers. @@ -563,7 +565,11 @@ void io_u_quiesce(struct thread_data *td) int fio_unused ret; ret = io_u_queued_complete(td, 1); + if (ret > 0) + completed += ret; } + + return completed; } static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir) @@ -1856,7 +1862,7 @@ int io_u_queued_complete(struct thread_data *td, int min_evts) for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++) td->bytes_done[ddir] += icd.bytes_done[ddir]; - return 0; + return ret; } /* diff --git a/ioengine.h b/ioengine.h index c557f7a8..37f0336a 100644 --- a/ioengine.h +++ b/ioengine.h @@ -214,7 +214,7 @@ extern void requeue_io_u(struct thread_data *, struct io_u **); extern int __must_check io_u_sync_complete(struct thread_data *, struct io_u *); extern int __must_check io_u_queued_complete(struct thread_data *, int); extern void io_u_queued(struct thread_data *, struct io_u *); -extern void io_u_quiesce(struct thread_data *); +extern int io_u_quiesce(struct thread_data *); extern void io_u_log_error(struct thread_data *, struct io_u *); extern void io_u_mark_depth(struct thread_data *, unsigned int); extern void fill_io_buffer(struct thread_data *, void *, unsigned int, unsigned int); -- 2.25.1