implement 'unit_base' option to select between KB and Kbit et. al.
[fio.git] / engines / sync.c
index bd912e7b5f808a2d7f1aa3c511802845a4510f01..87796289dcc9ca0591e265d1eee83696bd2eb034 100644 (file)
 
 #include "../fio.h"
 
+/*
+ * Sync engine uses engine_data to store last offset
+ */
+#define LAST_POS(f)    ((f)->engine_data)
+
 struct syncio_data {
        struct iovec *iovecs;
        struct io_u **io_us;
@@ -33,7 +38,7 @@ static int fio_syncio_prep(struct thread_data *td, struct io_u *io_u)
        if (!ddir_rw(io_u->ddir))
                return 0;
 
-       if (f->file_pos != -1ULL && f->file_pos == io_u->offset)
+       if (LAST_POS(f) != -1ULL && LAST_POS(f) == io_u->offset)
                return 0;
 
        if (lseek(f->fd, io_u->offset, SEEK_SET) == -1) {
@@ -47,7 +52,7 @@ static int fio_syncio_prep(struct thread_data *td, struct io_u *io_u)
 static int fio_io_end(struct thread_data *td, struct io_u *io_u, int ret)
 {
        if (io_u->file && ret >= 0 && ddir_rw(io_u->ddir))
-               io_u->file->file_pos = io_u->offset + ret;
+               LAST_POS(io_u->file) = io_u->offset + ret;
 
        if (ret != (int) io_u->xfer_buflen) {
                if (ret >= 0) {