t/zbd: avoid test case 31 failure with small devices
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 09e5f15a8b1ffe785adcd546da1e8232c9f47399..a090e12122642f238569f9fa663ab44d5091bef6 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -360,6 +360,17 @@ static int get_next_seq_offset(struct thread_data *td, struct fio_file *f,
                loop_cache_invalidate(td, f);
        }
 
+       /*
+        * If we reach the end for a rw-io-size based run, reset us back to 0
+        * and invalidate the cache, if we need to.
+        */
+       if (td_rw(td) && o->io_size > o->size) {
+               if (f->last_pos[ddir] >= f->io_size + get_start_offset(td, f)) {
+                       f->last_pos[ddir] = f->file_offset;
+                       loop_cache_invalidate(td, f);
+               }
+        }
+
        if (f->last_pos[ddir] < f->real_file_size) {
                uint64_t pos;
 
@@ -1054,8 +1065,8 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u)
                }
        }
 
-       if (td->o.fdp)
-               fdp_fill_dspec_data(td, io_u);
+       if (td->o.dp_type != FIO_DP_NONE)
+               dp_fill_dspec_data(td, io_u);
 
        if (io_u->offset + io_u->buflen > io_u->file->real_file_size) {
                dprint(FD_IO, "io_u %p, off=0x%llx + len=0x%llx exceeds file size=0x%llx\n",
@@ -2102,7 +2113,6 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
        if (ddir_sync(ddir)) {
                if (io_u->error)
                        goto error;
-               td->last_was_sync = true;
                if (f) {
                        f->first_write = -1ULL;
                        f->last_write = -1ULL;
@@ -2112,7 +2122,6 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
                return;
        }
 
-       td->last_was_sync = false;
        td->last_ddir = ddir;
 
        if (!io_u->error && ddir_rw(ddir)) {