4 * IO engine that doesn't do any real IO transfers, it just pretends to.
5 * The main purpose is to test fio itself.
22 static struct io_u *fio_null_event(struct thread_data *td, int event)
24 struct null_data *nd = td->io_ops->data;
26 return nd->io_us[event];
29 static int fio_null_getevents(struct thread_data *td, int min_events,
30 int fio_unused max, struct timespec fio_unused *t)
32 struct null_data *nd = td->io_ops->data;
43 static int fio_null_commit(struct thread_data *td)
45 struct null_data *nd = td->io_ops->data;
48 nd->events = nd->queued;
55 static int fio_null_queue(struct thread_data fio_unused *td, struct io_u *io_u)
57 struct null_data *nd = td->io_ops->data;
59 if (td->io_ops->flags & FIO_SYNCIO)
60 return FIO_Q_COMPLETED;
64 nd->io_us[nd->queued++] = io_u;
68 static int fio_null_open(struct thread_data fio_unused *td,
69 struct fio_file fio_unused *f)
74 static void fio_null_cleanup(struct thread_data *td)
76 struct null_data *nd = td->io_ops->data;
82 td->io_ops->data = NULL;
86 static int fio_null_init(struct thread_data *td)
88 struct null_data *nd = malloc(sizeof(*nd));
90 memset(nd, 0, sizeof(*nd));
92 if (td->o.iodepth != 1) {
93 nd->io_us = malloc(td->o.iodepth * sizeof(struct io_u *));
94 memset(nd->io_us, 0, td->o.iodepth * sizeof(struct io_u *));
96 td->io_ops->flags |= FIO_SYNCIO;
98 td->io_ops->data = nd;
102 static struct ioengine_ops ioengine = {
104 .version = FIO_IOOPS_VERSION,
105 .queue = fio_null_queue,
106 .commit = fio_null_commit,
107 .getevents = fio_null_getevents,
108 .event = fio_null_event,
109 .init = fio_null_init,
110 .cleanup = fio_null_cleanup,
111 .open_file = fio_null_open,
112 .flags = FIO_DISKLESSIO,
115 static void fio_init fio_null_register(void)
117 register_ioengine(&ioengine);
120 static void fio_exit fio_null_unregister(void)
122 unregister_ioengine(&ioengine);