file: unify ->file_data and ->file_pos
The only real use case of ->file_pos was by the sync engine to
avoid an lseek() if the offset was already correct. The e4defrag,
falloc, and fusion-aw engine also set ->file_pos, but that looks
like a case of copy-paste, since they don't actually use it.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/engines/sync.c b/engines/sync.c
index bd912e7..8779628 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 @@
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_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) {