Fully parallellize io_u verification
[fio.git] / ioengines.c
index a71357c67ddce9002b97f5d1afa4749a1e49100d..1b510dfe1daef46cd2be9c17255fff438a8d9928 100644 (file)
@@ -33,16 +33,27 @@ static int check_engine_ops(struct ioengine_ops *ops)
        if (ops->flags & FIO_CPUIO)
                return 0;
 
+       if (!ops->queue) {
+               log_err("%s: no queue handler\n", ops->name);
+               return 1;
+       }
+
+       /*
+        * sync engines only need a ->queue()
+        */
+       if (ops->flags & FIO_SYNCIO)
+               return 0;
+       
        if (!ops->event) {
-               log_err("%s: no event handler)\n", ops->name);
+               log_err("%s: no event handler\n", ops->name);
                return 1;
        }
        if (!ops->getevents) {
-               log_err("%s: no getevents handler)\n", ops->name);
+               log_err("%s: no getevents handler\n", ops->name);
                return 1;
        }
        if (!ops->queue) {
-               log_err("%s: no queue handler)\n", ops->name);
+               log_err("%s: no queue handler\n", ops->name);
                return 1;
        }
                
@@ -57,9 +68,6 @@ void unregister_ioengine(struct ioengine_ops *ops)
 
 int register_ioengine(struct ioengine_ops *ops)
 {
-       if (check_engine_ops(ops))
-               return 1;
-
        INIT_LIST_HEAD(&ops->list);
        list_add_tail(&ops->list, &engine_list);
        return 0;
@@ -98,6 +106,10 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td,
                return NULL;
        }
 
+       /*
+        * Unlike the included modules, external engines should have a
+        * non-static ioengine structure that we can reference.
+        */
        ops = dlsym(dlhandle, "ioengine");
        if (!ops) {
                td_vmsg(td, -1, dlerror());
@@ -158,8 +170,8 @@ void close_ioengine(struct thread_data *td)
 
 int td_io_prep(struct thread_data *td, struct io_u *io_u)
 {
-       if (td->io_ops->prep && td->io_ops->prep(td, io_u))
-               return 1;
+       if (td->io_ops->prep)
+               return td->io_ops->prep(td, io_u);
 
        return 0;
 }
@@ -167,12 +179,15 @@ int td_io_prep(struct thread_data *td, struct io_u *io_u)
 int td_io_getevents(struct thread_data *td, int min, int max,
                    struct timespec *t)
 {
-       return td->io_ops->getevents(td, min, max, t);
+       if (td->io_ops->getevents)
+               return td->io_ops->getevents(td, min, max, t);
+
+       return 0;
 }
 
 int td_io_queue(struct thread_data *td, struct io_u *io_u)
 {
-       gettimeofday(&io_u->issue_time, NULL);
+       fio_gettime(&io_u->issue_time, NULL);
 
        return td->io_ops->queue(td, io_u);
 }