Update io engine comments
[fio.git] / engines / syslet-rw.c
index 4b1b263691f5825ef247b38a564a8c66f6d4f3cb..279884a5d041094774cb7bfcde31266fb642b2fe 100644 (file)
@@ -1,5 +1,8 @@
 /*
- * read/write() engine that uses syslet to be async
+ * syslet engine
+ *
+ * IO engine that does regular pread(2)/pwrite(2) to transfer data, but
+ * with syslets to make the execution async.
  *
  */
 #include <stdio.h>
@@ -46,7 +49,7 @@ static void fio_syslet_complete_atom(struct thread_data *td,
 
                io_u = atom->private;
                ret = *atom->ret_ptr;
-               if (ret > 0)
+               if (ret >= 0)
                        io_u->resid = io_u->xfer_buflen - ret;
                else if (ret < 0)
                        io_u->error = ret;
@@ -187,6 +190,23 @@ static unsigned long thread_stack_alloc()
        return (unsigned long) malloc(THREAD_STACK_SIZE) + THREAD_STACK_SIZE;
 }
 
+static void fio_syslet_queued(struct thread_data *td, struct syslet_data *sd)
+{
+       struct syslet_uatom *atom;
+       struct timeval now;
+
+       fio_gettime(&now, NULL);
+
+       atom = sd->head;
+       while (atom) {
+               struct io_u *io_u = atom->private;
+
+               memcpy(&io_u->issue_time, &now, sizeof(now));
+               io_u_queued(td, io_u);
+               atom = atom->next;
+       }
+}
+
 static int fio_syslet_commit(struct thread_data *td)
 {
        struct syslet_data *sd = td->io_ops->data;
@@ -200,6 +220,8 @@ static int fio_syslet_commit(struct thread_data *td)
        if (!sd->ahu.new_thread_stack)
                sd->ahu.new_thread_stack = thread_stack_alloc();
 
+       fio_syslet_queued(td, sd);
+
        /*
         * On sync completion, the atom is returned. So on NULL return
         * it's queued asynchronously.
@@ -298,6 +320,8 @@ static struct ioengine_ops ioengine = {
        .getevents      = fio_syslet_getevents,
        .event          = fio_syslet_event,
        .cleanup        = fio_syslet_cleanup,
+       .open_file      = generic_open_file,
+       .close_file     = generic_close_file,
 };
 
 #else /* FIO_HAVE_SYSLET */