4 #define FIO_IOOPS_VERSION 10
8 IO_U_F_FLIGHT = 1 << 1,
16 #ifdef FIO_HAVE_LIBAIO
19 #ifdef FIO_HAVE_POSIXAIO
28 #ifdef FIO_HAVE_SOLARISAIO
33 struct timeval start_time;
34 struct timeval issue_time;
37 * Allocated/set buffer and length
41 unsigned long long offset;
44 * IO engine state, may be different from above when we get
45 * partial transfers / residual data counts
48 unsigned long xfer_buflen;
56 * io engine private data
66 struct fio_file *file;
68 struct flist_head list;
71 * Callback for io completion
73 int (*end_io)(struct thread_data *, struct io_u *);
77 * io_ops->queue() return values
80 FIO_Q_COMPLETED = 0, /* completed sync */
81 FIO_Q_QUEUED = 1, /* queued, will complete async */
82 FIO_Q_BUSY = 2, /* no more room, call ->commit() */
86 struct flist_head list;
90 int (*setup)(struct thread_data *);
91 int (*init)(struct thread_data *);
92 int (*prep)(struct thread_data *, struct io_u *);
93 int (*queue)(struct thread_data *, struct io_u *);
94 int (*commit)(struct thread_data *);
95 int (*getevents)(struct thread_data *, unsigned int, unsigned int, struct timespec *);
96 struct io_u *(*event)(struct thread_data *, int);
97 int (*cancel)(struct thread_data *, struct io_u *);
98 void (*cleanup)(struct thread_data *);
99 int (*open_file)(struct thread_data *, struct fio_file *);
100 int (*close_file)(struct thread_data *, struct fio_file *);
101 int (*get_file_size)(struct thread_data *, struct fio_file *);
106 enum fio_ioengine_flags {
107 FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
108 FIO_RAWIO = 1 << 1, /* some sort of direct/raw io */
109 FIO_DISKLESSIO = 1 << 2, /* no disk involved */
110 FIO_NOEXTEND = 1 << 3, /* engine can't extend file */
111 FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
112 FIO_UNIDIR = 1 << 5, /* engine is uni-directional */
113 FIO_NOIO = 1 << 6, /* thread does only pseudo IO */
114 FIO_SIGQUIT = 1 << 7, /* needs SIGQUIT to exit */
118 * io engine entry points
120 extern int __must_check td_io_init(struct thread_data *);
121 extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
122 extern int __must_check td_io_queue(struct thread_data *, struct io_u *);
123 extern int __must_check td_io_sync(struct thread_data *, struct fio_file *);
124 extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
125 extern int __must_check td_io_commit(struct thread_data *);
126 extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
127 extern int td_io_close_file(struct thread_data *, struct fio_file *);
128 extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
130 extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
131 extern void register_ioengine(struct ioengine_ops *);
132 extern void unregister_ioengine(struct ioengine_ops *);
133 extern void close_ioengine(struct thread_data *);
138 #define queue_full(td) flist_empty(&(td)->io_u_freelist)
139 extern struct io_u *__get_io_u(struct thread_data *);
140 extern struct io_u *get_io_u(struct thread_data *);
141 extern void put_io_u(struct thread_data *, struct io_u *);
142 extern void requeue_io_u(struct thread_data *, struct io_u **);
143 extern long __must_check io_u_sync_complete(struct thread_data *, struct io_u *);
144 extern long __must_check io_u_queued_complete(struct thread_data *, int);
145 extern void io_u_queued(struct thread_data *, struct io_u *);
146 extern void io_u_log_error(struct thread_data *, struct io_u *);
147 extern void io_u_mark_depth(struct thread_data *, unsigned int);
148 extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned int);
149 void io_u_mark_complete(struct thread_data *, unsigned int);
150 void io_u_mark_submit(struct thread_data *, unsigned int);
153 static inline void dprint_io_u(struct io_u *io_u, const char *p)
155 struct fio_file *f = io_u->file;
157 dprint(FD_IO, "%s: io_u %p: off=%llu/len=%lu/ddir=%d", p, io_u,
158 (unsigned long long) io_u->offset,
159 io_u->buflen, io_u->ddir);
160 if (fio_debug & (1 << FD_IO)) {
162 log_info("/%s", f->file_name);
168 #define dprint_io_u(io_u, p)