Remove the file->last_completed_pos variable
authorJens Axboe <jens.axboe@oracle.com>
Sat, 1 Mar 2008 17:09:49 +0000 (18:09 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Sat, 1 Mar 2008 17:09:49 +0000 (18:09 +0100)
This tracks where we last did IO to this file, however with file
sharing that may break. So just remove this optimization, it'll
cost an extra lseek() for the sync engine but doesn't do much else
outside of that.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
engines/net.c
engines/sync.c
fio.c
fio.h
io_u.c
ioengines.c

index f6ae37905abf16750f74ed151cc28154002665c5..60d53bc27a5bda48a9996185b03dc844e9cc631e 100644 (file)
@@ -28,7 +28,6 @@ struct netio_data {
 static int fio_netio_prep(struct thread_data *td, struct io_u *io_u)
 {
        struct netio_data *nd = td->io_ops->data;
-       struct fio_file *f = io_u->file;
 
        /*
         * Make sure we don't see spurious reads to a receiver, and vice versa
@@ -39,17 +38,7 @@ static int fio_netio_prep(struct thread_data *td, struct io_u *io_u)
                return 1;
        }
                
-       if (io_u->ddir == DDIR_SYNC)
-               return 0;
-       if (io_u->offset == f->last_completed_pos)
-               return 0;
-
-       /*
-        * If offset is different from last end position, it's a seek.
-        * As network io is purely sequential, we don't allow seeks.
-        */
-       td_verror(td, EINVAL, "cannot seek");
-       return 1;
+       return 0;
 }
 
 static int splice_io_u(int fdin, int fdout, unsigned int len)
index c5410c7d4a97f6cbef713de04e15608b0e90f7e8..46cb864d770b7819015f354c325c8410fbb878b5 100644 (file)
@@ -30,8 +30,6 @@ static int fio_syncio_prep(struct thread_data *td, struct io_u *io_u)
 
        if (io_u->ddir == DDIR_SYNC)
                return 0;
-       if (io_u->offset == f->last_completed_pos)
-               return 0;
 
        if (lseek(f->fd, io_u->offset, SEEK_SET) == -1) {
                td_verror(td, errno, "lseek");
diff --git a/fio.c b/fio.c
index c609f55d8e9520672e8c1e67e8c7b811dbceb002..c2bc1a67625f0d7b991486143dd6bc385472ac78 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -359,7 +359,6 @@ static void do_verify(struct thread_data *td)
                                io_u->xfer_buflen = io_u->resid;
                                io_u->xfer_buf += bytes;
                                io_u->offset += bytes;
-                               f->last_completed_pos = io_u->offset;
 
                                td->ts.short_io_u[io_u->ddir]++;
 
@@ -485,7 +484,6 @@ static void do_io(struct thread_data *td)
                                io_u->xfer_buflen = io_u->resid;
                                io_u->xfer_buf += bytes;
                                io_u->offset += bytes;
-                               f->last_completed_pos = io_u->offset;
 
                                td->ts.short_io_u[io_u->ddir]++;
 
diff --git a/fio.h b/fio.h
index ca35ffcd5e7884c8fce02f9ad741b45bb8a67e10..b0ba0ac4c18dd7faf75e842655b2304b2d5c283f 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -306,7 +306,6 @@ struct fio_file {
        unsigned long long io_size;
 
        unsigned long long last_pos;
-       unsigned long long last_completed_pos;
 
        /*
         * block map for random io
diff --git a/io_u.c b/io_u.c
index 0f455cfd916d7ac5c8c6b3a69f7d83f66c8a24a3..5a3157a24c498e123db83914eb36e904f1890e24 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -824,8 +824,6 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                td->io_bytes[idx] += bytes;
                td->this_io_bytes[idx] += bytes;
 
-               io_u->file->last_completed_pos = io_u->endpos;
-
                usec = utime_since(&io_u->issue_time, &icd->time);
 
                add_clat_sample(td, idx, usec);
index a81c7b884b5df6352cca79d5e47bb5eae47b2973..879c5f1c1f438a20a5116bec93968fc0d4e0642f 100644 (file)
@@ -303,7 +303,6 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
        }
 
        f->last_free_lookup = 0;
-       f->last_completed_pos = 0;
        f->last_pos = f->file_offset;
        f->flags |= FIO_FILE_OPEN;
        f->flags &= ~FIO_FILE_CLOSING;