Reuse filled pattern
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index b2b72302d58ee8b0790fb123dd882c508bbd9360..dc4473beab1737660f2ebeb2f1c91418b1a14da6 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -983,6 +983,14 @@ struct io_u *get_io_u(struct thread_data *td)
                        populate_verify_io_u(td, io_u);
                else if (td->o.refill_buffers && io_u->ddir == DDIR_WRITE)
                        io_u_fill_buffer(td, io_u, io_u->xfer_buflen);
+               else if (io_u->ddir == DDIR_READ) {
+                       /*
+                        * Reset the buf_filled parameters so next time if the
+                        * buffer is used for writes it is refilled.
+                        */
+                       io_u->buf_filled = 0;
+                       io_u->buf_filled_len = 0;
+               }
        }
 
        /*