Change IO engine queuing
[fio.git] / ioengines.c
index 1666612a9bf6dbe121e1c8a87c682e61786af228..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;
@@ -162,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;
 }
@@ -171,7 +179,10 @@ 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)