[PATCH] Fix libaio engine SYNC
authorJens Axboe <jens.axboe@oracle.com>
Sat, 10 Feb 2007 11:57:55 +0000 (12:57 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Sat, 10 Feb 2007 11:57:55 +0000 (12:57 +0100)
io_prep_fsync() isn't supported at all in Linux currently, so
fall back to fsync() if we get an -EINVAL return value.

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

index 9a644f6fe4d07d17be9997a7cc94c882c275cd3e..c95600548c645449a07946b7cabb8c7b6de5162b 100644 (file)
@@ -82,7 +82,17 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
                        usleep(100);
                else if (ret == -EINTR)
                        continue;
-               else
+               else if (ret == -EINVAL && io_u->ddir == DDIR_SYNC) {
+                       /*
+                        * the async fsync doesn't currently seem to be
+                        * supported, so just fsync if we fail with EINVAL
+                        * for a sync. since buffered io is also sync
+                        * with libaio (still), we don't have pending
+                        * requests to flush first.
+                        */
+                       ret = fsync(io_u->file->fd);
+                       break;
+               } else
                        break;
        } while (1);