Only memcpy last issue time when using iolog replay
[fio.git] / ioengines.c
index 1a7a6301d0b6b4d42112e62b8c520813a3c4530b..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
@@ -367,6 +381,21 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
        if (f->file_map)
                memset(f->file_map, 0, f->num_maps * sizeof(int));
 
+#ifdef FIO_OS_DIRECTIO
+       /*
+        * Some OS's have a distinct call to mark the file non-buffered,
+        * instead of using O_DIRECT (Solaris)
+        */
+       if (td->o.odirect) {
+               int ret = fio_set_odirect(f->fd);
+
+               if (ret) {
+                       td_verror(td, ret, "fio_set_odirect");
+                       goto err;
+               }
+       }
+#endif
+
 done:
        log_file(td, f, FIO_LOG_OPEN_FILE);
        return 0;