Issue time fixup for guasi/libaio
[fio.git] / engines / sync.c
index e966846cd34c3d560b3c03e2177e42d1a65cb0dc..4ca04d5e9cbfad9c52f7c322920fc6dedde345c2 100644 (file)
@@ -8,6 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <sys/uio.h>
 #include <errno.h>
 #include <assert.h>
 
@@ -17,6 +18,7 @@ struct syncio_data {
        struct iovec *iovecs;
        struct io_u **io_us;
        unsigned int queued;
+       unsigned int events;
        unsigned long queued_bytes;
 
        unsigned long long last_offset;
@@ -98,8 +100,8 @@ static int fio_vsyncio_getevents(struct thread_data *td, unsigned int min,
        int ret;
 
        if (min) {
-               ret = sd->queued;
-               sd->queued = 0;
+               ret = sd->events;
+               sd->events = 0;
        } else
                ret = 0;
 
@@ -246,6 +248,8 @@ static int fio_vsyncio_commit(struct thread_data *td)
                ret = writev(f->fd, sd->iovecs, sd->queued);
 
        dprint(FD_IO, "vsyncio_commit: %d\n", (int) ret);
+       sd->events = sd->queued;
+       sd->queued = 0;
        return fio_vsyncio_end(td, ret);
 }
 
@@ -270,7 +274,6 @@ static void fio_vsyncio_cleanup(struct thread_data *td)
        free(sd->iovecs);
        free(sd->io_us);
        free(sd);
-       td->io_ops->data = NULL;
 }
 
 static struct ioengine_ops ioengine_rw = {