vsync: Fix issue with double issue of io_u
authorJens Axboe <jens.axboe@oracle.com>
Fri, 30 May 2008 20:03:46 +0000 (22:03 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 30 May 2008 20:03:46 +0000 (22:03 +0200)
We'd lseek to the same location twice, making sequential
IO lseek() and read/write to each location twice.

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

index 561e77ba02539e7ca88e5a70ea141a01c0a66529..3b96ee1d4ba682949d3067a795b81f7728db0853 100644 (file)
@@ -18,6 +18,7 @@ struct syncio_data {
        struct iovec *iovecs;
        struct io_u **io_us;
        unsigned int queued;
        struct iovec *iovecs;
        struct io_u **io_us;
        unsigned int queued;
+       unsigned int events;
        unsigned long queued_bytes;
 
        unsigned long long last_offset;
        unsigned long queued_bytes;
 
        unsigned long long last_offset;
@@ -99,8 +100,8 @@ static int fio_vsyncio_getevents(struct thread_data *td, unsigned int min,
        int ret;
 
        if (min) {
        int ret;
 
        if (min) {
-               ret = sd->queued;
-               sd->queued = 0;
+               ret = sd->events;
+               sd->events = 0;
        } else
                ret = 0;
 
        } else
                ret = 0;
 
@@ -247,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);
                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);
 }
 
        return fio_vsyncio_end(td, ret);
 }