X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fnull.c;h=6bd51bab218d8179db7cce5fdd7945828fba7ef3;hp=fc829473acc39bc8b494bde47ba59012cf3de145;hb=bc5b77a8c46aabea554c4a2c8cca37f27f97969a;hpb=f8fe35e8c9e88dd681ea151251d75f6116a958b4;ds=sidebyside diff --git a/engines/null.c b/engines/null.c index fc829473..6bd51bab 100644 --- a/engines/null.c +++ b/engines/null.c @@ -11,66 +11,18 @@ #include "../fio.h" #include "../os.h" -struct null_data { - struct io_u *last_io_u; -}; - -static int fio_null_getevents(struct thread_data *td, int fio_unused min, - int max, struct timespec fio_unused *t) -{ - assert(max <= 1); - - if (list_empty(&td->io_u_busylist)) - return 0; - - return 1; -} - -static struct io_u *fio_null_event(struct thread_data *td, int event) -{ - struct null_data *nd = td->io_ops->data; - - assert(event == 0); - - return nd->last_io_u; -} - -static int fio_null_queue(struct thread_data *td, struct io_u *io_u) +static int fio_null_queue(struct thread_data fio_unused *td, struct io_u *io_u) { - struct null_data *nd = td->io_ops->data; - io_u->resid = 0; io_u->error = 0; - nd->last_io_u = io_u; - return 0; -} - -static void fio_null_cleanup(struct thread_data *td) -{ - if (td->io_ops->data) { - free(td->io_ops->data); - td->io_ops->data = NULL; - } -} - -static int fio_null_init(struct thread_data *td) -{ - struct null_data *nd = malloc(sizeof(*nd)); - - nd->last_io_u = NULL; - td->io_ops->data = nd; - return 0; + return FIO_Q_COMPLETED; } static struct ioengine_ops ioengine = { .name = "null", .version = FIO_IOOPS_VERSION, - .init = fio_null_init, .queue = fio_null_queue, - .getevents = fio_null_getevents, - .event = fio_null_event, - .cleanup = fio_null_cleanup, - .flags = FIO_SYNCIO, + .flags = FIO_SYNCIO | FIO_NULLIO, }; static void fio_init fio_null_register(void)