X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fsync.c;fp=engines%2Fsync.c;h=87796289dcc9ca0591e265d1eee83696bd2eb034;hp=bd912e7b5f808a2d7f1aa3c511802845a4510f01;hb=ef5f5a3a63f8b7c472f30484c520265aba6ef162;hpb=e6c4d732fc99070091367d0ce41fe2cf1ddd1dc9 diff --git a/engines/sync.c b/engines/sync.c index bd912e7b..87796289 100644 --- a/engines/sync.c +++ b/engines/sync.c @@ -14,6 +14,11 @@ #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) {