X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ioengines.c;h=16ea928fe727c094f651e75922f52308eb36c70a;hp=56a718c6cfea2f9cd26738560d76036d5a8385a1;hb=d2d7fa53c18f1fc3fb89f3fe20df9b39986bde72;hpb=da51c0505c753f64ad5f65808377b8f67b445828;ds=inline diff --git a/ioengines.c b/ioengines.c index 56a718c6..16ea928f 100644 --- a/ioengines.c +++ b/ioengines.c @@ -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,12 +179,18 @@ 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); + + if (io_u->ddir != DDIR_SYNC) + td->io_issues[io_u->ddir]++; return td->io_ops->queue(td, io_u); } @@ -188,3 +202,11 @@ int td_io_init(struct thread_data *td) return 0; } + +int td_io_commit(struct thread_data *td) +{ + if (td->io_ops->commit) + return td->io_ops->commit(td); + + return 0; +}