libaio: commit on EAGAIN
authorJens Axboe <axboe@fb.com>
Wed, 8 Oct 2014 02:03:14 +0000 (20:03 -0600)
committerJens Axboe <axboe@fb.com>
Wed, 8 Oct 2014 02:03:14 +0000 (20:03 -0600)
If we have pending IOs, commit them.

Signed-off-by: Jens Axboe <axboe@fb.com>
engines/libaio.c

index d11a262e62cbaf8b0c30bf47e52b9dfaa584ae86..7c3a42a48fd99a4819ea020755c8c07a512ac5c7 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "../fio.h"
 
+static int fio_libaio_commit(struct thread_data *td);
+
 struct libaio_data {
        io_context_t aio_ctx;
        struct io_event *aio_events;
@@ -165,9 +167,10 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
                }
                if (r >= 0)
                        events += r;
-               else if (r == -EAGAIN)
+               else if (r == -EAGAIN) {
+                       fio_libaio_commit(td);
                        usleep(100);
-               else if (r != -EINTR)
+               else if (r != -EINTR)
                        break;
        } while (events < min);