Fixing wraparound behavior for time-based sequential read jobs
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index a4f378d811dd87df2481db8756ee463306e44f9e..2f5456294cea559bd97504f7c534626eb0933344 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -256,7 +256,7 @@ static int get_next_seq_offset(struct thread_data *td, struct fio_file *f,
 {
        assert(ddir_rw(ddir));
 
-       if (f->last_pos >= f->io_size && td->o.time_based)
+       if (f->last_pos >= f->io_size + get_start_offset(td) && td->o.time_based)
                f->last_pos = f->last_pos - f->io_size;
 
        if (f->last_pos < f->real_file_size) {
@@ -377,7 +377,7 @@ static inline int io_u_fits(struct thread_data *td, struct io_u *io_u,
 {
        struct fio_file *f = io_u->file;
 
-       return io_u->offset + buflen <= f->io_size + td->o.start_offset;
+       return io_u->offset + buflen <= f->io_size + get_start_offset(td);
 }
 
 static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u)
@@ -1381,7 +1381,9 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                td->io_blocks[idx]++;
                td->this_io_blocks[idx]++;
                td->io_bytes[idx] += bytes;
-               td->this_io_bytes[idx] += bytes;
+
+               if (!(io_u->flags & IO_U_F_VER_LIST))
+                       td->this_io_bytes[idx] += bytes;
 
                if (idx == DDIR_WRITE) {
                        f = io_u->file;