From: Jens Axboe Date: Sat, 10 Feb 2007 13:49:02 +0000 (+0100) Subject: [PATCH] Make the libaio fsync fallback really work X-Git-Tag: fio-1.12~114 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=311b84aeb3f8eba70191353b4b9fe0a2576f9d95;ds=inline [PATCH] Make the libaio fsync fallback really work This time it's tested :-) Signed-off-by: Jens Axboe --- diff --git a/engines/libaio.c b/engines/libaio.c index acc125f4..47c1d4b8 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -88,7 +88,7 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u) do { ret = io_submit(ld->aio_ctx, 1, &iocb); if (ret == 1) - return 0; + break; else if (ret == -EAGAIN || !ret) usleep(100); else if (ret == -EINTR) @@ -101,8 +101,12 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u) * with libaio (still), we don't have pending * requests to flush first. */ - ret = fsync(io_u->file->fd); - ld->sync_io_u = io_u; + if (fsync(io_u->file->fd) < 0) + ret = errno; + else { + ret = 1; + ld->sync_io_u = io_u; + } break; } else break;