[PATCH] Fix busy-looping with aio engine and depth > 1
authorJens Axboe <jens.axboe@oracle.com>
Mon, 8 Jan 2007 21:27:05 +0000 (22:27 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 8 Jan 2007 21:27:05 +0000 (22:27 +0100)
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 <jens.axboe@oracle.com>
engines/fio-engine-libaio.c

index 45e69e90b600704df35dfb1d2f23a91857531c7f..da43f18ce1571b7c729ceb35fce02ec1aae00e12 100644 (file)
@@ -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);
 
        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)
                        usleep(100);
                        continue;
                } else if (r == -EINTR)