From: Jens Axboe Date: Mon, 8 Jan 2007 21:27:05 +0000 (+0100) Subject: [PATCH] Fix busy-looping with aio engine and depth > 1 X-Git-Tag: fio-1.11~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=ccbb91cb902f5a1931681248735551815d12c653;hp=1188caf84ba7fb6c2b3955ad67f4bf087ede13fd [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 --- 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)