Reuse filled pattern
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 69edd70e5eafbb97ce3f5f915ee50450fcc90ac6..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;
+               }
        }
 
        /*
@@ -1079,7 +1087,13 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                        if (!td->o.disable_clat || !td->o.disable_bw)
                                lusec = utime_since(&io_u->issue_time,
                                                        &icd->time);
+                       if (!td->o.disable_lat) {
+                               unsigned long tusec;
 
+                               tusec = utime_since(&io_u->start_time,
+                                                       &icd->time);
+                               add_lat_sample(td, idx, tusec, bytes);
+                       }
                        if (!td->o.disable_clat) {
                                add_clat_sample(td, idx, lusec, bytes);
                                io_u_mark_latency(td, lusec);