From 1ad72b11ceb01d2c8e847f8d53e38e1a237a8e2d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 7 Nov 2005 16:48:11 +0100 Subject: [PATCH] [PATCH] fio: make the aio path handle resubmits --- fio.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/fio.c b/fio.c index 8085c74..27e0e36 100644 --- a/fio.c +++ b/fio.c @@ -1007,6 +1007,20 @@ static void do_sync_io(struct thread_data *td) fsync(td->fd); } +static int io_u_getevents(struct thread_data *td, int min, int max, + struct timespec *t) +{ + int r; + + do { + r = io_getevents(td->aio_ctx, min, max, td->aio_events, t); + if (r != -EAGAIN && r != -EINTR) + break; + } while (1); + + return r; +} + static int io_u_queue(struct thread_data *td, struct io_u *io_u) { struct iocb *iocb = &io_u->iocb; @@ -1071,7 +1085,7 @@ static void cleanup_pending_aio(struct thread_data *td) /* * get immediately available events, if any */ - r = io_getevents(td->aio_ctx, 0, td->cur_depth, td->aio_events, &ts); + r = io_u_getevents(td, 0, td->cur_depth, &ts); if (r > 0) ios_completed(td, r); @@ -1087,7 +1101,7 @@ static void cleanup_pending_aio(struct thread_data *td) } if (td->cur_depth) { - r = io_getevents(td->aio_ctx, td->cur_depth, td->cur_depth, td->aio_events, NULL); + r = io_u_getevents(td, td->cur_depth, td->cur_depth, NULL); if (r > 0) ios_completed(td, r); } @@ -1147,7 +1161,7 @@ static void do_async_verify(struct thread_data *td) if (async_do_verify(td, &v_io_u)) break; - ret = io_getevents(td->aio_ctx, 1, 1, td->aio_events, NULL); + ret = io_u_getevents(td, 1, 1, NULL); if (ret != 1) { if (ret < 0) td->error = ret; @@ -1212,7 +1226,7 @@ static void do_async_io(struct thread_data *td) min_evts = 1; } - ret = io_getevents(td->aio_ctx, min_evts, td->cur_depth, td->aio_events, timeout); + ret = io_u_getevents(td, min_evts, td->cur_depth, timeout); if (ret < 0) { td->error = errno; break; -- 2.25.1