Only memcpy last issue time when using iolog replay
[fio.git] / ioengines.c
index 8975591d080acb0efc55894e2f40ec830df9d1fd..1688c633db66233fe55caf8284f195d4a7bac8a0 100644 (file)
@@ -195,9 +195,13 @@ int td_io_getevents(struct thread_data *td, unsigned int min, unsigned int max,
                if (r < 0)
                        goto out;
        }
+       if (max > td->cur_depth)
+               max = td->cur_depth;
+       if (min > max)
+               max = min;
 
        r = 0;
-       if (td->io_ops->getevents)
+       if (max && td->io_ops->getevents)
                r = td->io_ops->getevents(td, min, max, t);
 out:
        if (r >= 0)
@@ -223,7 +227,12 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
 
        if (td->io_ops->flags & FIO_SYNCIO) {
                fio_gettime(&io_u->issue_time, NULL);
-               memcpy(&td->last_issue, &io_u->issue_time,
+
+               /*
+                * only used for iolog
+                */
+               if (td->o.read_iolog_file)
+                       memcpy(&td->last_issue, &io_u->issue_time,
                                        sizeof(struct timeval));
 
                /*
@@ -268,8 +277,13 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
 
        if ((td->io_ops->flags & FIO_SYNCIO) == 0) {
                fio_gettime(&io_u->issue_time, NULL);
-               memcpy(&td->last_issue, &io_u->issue_time,
-                               sizeof(struct timeval));
+
+               /*
+                * only used for iolog
+                */
+               if (td->o.read_iolog_file)
+                       memcpy(&td->last_issue, &io_u->issue_time,
+                                       sizeof(struct timeval));
 
                /*
                 * async engine, set the timeout here