Fix sync engine completion latency
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 3c64b7b7cab87a1eb0a40d342bb410244a3b360f..4596544429c9212e6cabc60b15ff9f09f7ef6291 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -385,6 +385,13 @@ requeue:
                                ret = bytes_done;
                        break;
                case FIO_Q_QUEUED:
+                       /*
+                        * if the engine doesn't have a commit hook,
+                        * the io_u is really queued. if it does have such
+                        * a hook, it has to call io_u_queued() itself.
+                        */
+                       if (td->io_ops->commit == NULL)
+                               io_u_queued(td, io_u);
                        break;
                case FIO_Q_BUSY:
                        requeue_io_u(td, &io_u);
@@ -399,9 +406,6 @@ requeue:
                if (ret < 0 || td->error)
                        break;
 
-               if (io_u)
-                       add_slat_sample(td, io_u->ddir, mtime_since(&io_u->start_time, &io_u->issue_time));
-
                /*
                 * See if we need to complete some commands
                 */
@@ -597,7 +601,11 @@ static void clear_io_state(struct thread_data *td)
        td->this_io_bytes[0] = td->this_io_bytes[1] = 0;
        td->zone_bytes = 0;
 
+       td->last_was_sync = 0;
+
        for_each_file(td, f, i) {
+               f->last_completed_pos = 0;
+
                f->last_pos = 0;
                if (td->io_ops->flags & FIO_SYNCIO)
                        lseek(f->fd, SEEK_SET, 0);