From ccbb91cb902f5a1931681248735551815d12c653 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 8 Jan 2007 22:27:05 +0100 Subject: [PATCH 1/1] [PATCH] Fix busy-looping with aio engine and depth > 1 It's ok for io_getevents() to return 0, if min_nr is 0. Check first if io_getevents() returns >= min_nr, if so then just break and return. Signed-off-by: Jens Axboe --- engines/fio-engine-libaio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/fio-engine-libaio.c b/engines/fio-engine-libaio.c index 45e69e90..da43f18c 100644 --- a/engines/fio-engine-libaio.c +++ b/engines/fio-engine-libaio.c @@ -51,7 +51,9 @@ static int fio_libaio_getevents(struct thread_data *td, int min, int max, do { r = io_getevents(ld->aio_ctx, min, max, ld->aio_events, t); - if (r == -EAGAIN) { + if (r >= min) + break; + else if (r == -EAGAIN) { usleep(100); continue; } else if (r == -EINTR) -- 2.25.1