4 #define FIO_IOOPS_VERSION 12
8 IO_U_F_FLIGHT = 1 << 1,
9 IO_U_F_FREE_DEF = 1 << 2,
10 IO_U_F_IN_CUR_DEPTH = 1 << 3,
11 IO_U_F_BUSY_OK = 1 << 4,
12 IO_U_F_TRIMMED = 1 << 5,
13 IO_U_F_BARRIER = 1 << 6,
21 #ifdef FIO_HAVE_LIBAIO
24 #ifdef FIO_HAVE_POSIXAIO
33 #ifdef FIO_HAVE_SOLARISAIO
36 #ifdef FIO_HAVE_BINJECT
37 struct b_user_cmd buc;
41 struct timeval start_time;
42 struct timeval issue_time;
45 * Allocated/set buffer and length
49 unsigned long long offset;
52 * IO engine state, may be different from above when we get
53 * partial transfers / residual data counts
56 unsigned long xfer_buflen;
59 * Parameter related to pre-filled buffers and
60 * their size to handle variable block sizes.
62 unsigned long buf_filled_len;
70 * io engine private data
80 struct fio_file *file;
82 struct flist_head list;
85 * Callback for io completion
87 int (*end_io)(struct thread_data *, struct io_u *);
91 * io_ops->queue() return values
94 FIO_Q_COMPLETED = 0, /* completed sync */
95 FIO_Q_QUEUED = 1, /* queued, will complete async */
96 FIO_Q_BUSY = 2, /* no more room, call ->commit() */
100 struct flist_head list;
104 int (*setup)(struct thread_data *);
105 int (*init)(struct thread_data *);
106 int (*prep)(struct thread_data *, struct io_u *);
107 int (*queue)(struct thread_data *, struct io_u *);
108 int (*commit)(struct thread_data *);
109 int (*getevents)(struct thread_data *, unsigned int, unsigned int, struct timespec *);
110 struct io_u *(*event)(struct thread_data *, int);
111 int (*cancel)(struct thread_data *, struct io_u *);
112 void (*cleanup)(struct thread_data *);
113 int (*open_file)(struct thread_data *, struct fio_file *);
114 int (*close_file)(struct thread_data *, struct fio_file *);
115 int (*get_file_size)(struct thread_data *, struct fio_file *);
120 enum fio_ioengine_flags {
121 FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
122 FIO_RAWIO = 1 << 1, /* some sort of direct/raw io */
123 FIO_DISKLESSIO = 1 << 2, /* no disk involved */
124 FIO_NOEXTEND = 1 << 3, /* engine can't extend file */
125 FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
126 FIO_UNIDIR = 1 << 5, /* engine is uni-directional */
127 FIO_NOIO = 1 << 6, /* thread does only pseudo IO */
128 FIO_SIGTERM = 1 << 7, /* needs SIGTERM to exit */
129 FIO_PIPEIO = 1 << 8, /* input/output no seekable */
130 FIO_BARRIER = 1 << 9, /* engine supports barriers */
131 FIO_MEMALIGN = 1 << 10, /* engine wants aligned memory */
135 * io engine entry points
137 extern int __must_check td_io_init(struct thread_data *);
138 extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
139 extern int __must_check td_io_queue(struct thread_data *, struct io_u *);
140 extern int __must_check td_io_sync(struct thread_data *, struct fio_file *);
141 extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
142 extern int __must_check td_io_commit(struct thread_data *);
143 extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
144 extern int td_io_close_file(struct thread_data *, struct fio_file *);
145 extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
147 extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
148 extern void register_ioengine(struct ioengine_ops *);
149 extern void unregister_ioengine(struct ioengine_ops *);
150 extern void close_ioengine(struct thread_data *);
155 #define queue_full(td) flist_empty(&(td)->io_u_freelist)
156 extern struct io_u *__get_io_u(struct thread_data *);
157 extern struct io_u *get_io_u(struct thread_data *);
158 extern void put_io_u(struct thread_data *, struct io_u *);
159 extern void clear_io_u(struct thread_data *, struct io_u *);
160 extern void requeue_io_u(struct thread_data *, struct io_u **);
161 extern int __must_check io_u_sync_complete(struct thread_data *, struct io_u *, unsigned long *);
162 extern int __must_check io_u_queued_complete(struct thread_data *, int, unsigned long *);
163 extern void io_u_queued(struct thread_data *, struct io_u *);
164 extern void io_u_log_error(struct thread_data *, struct io_u *);
165 extern void io_u_mark_depth(struct thread_data *, unsigned int);
166 extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned int);
167 void io_u_mark_complete(struct thread_data *, unsigned int);
168 void io_u_mark_submit(struct thread_data *, unsigned int);
170 int do_io_u_sync(struct thread_data *, struct io_u *);
171 int do_io_u_trim(struct thread_data *, struct io_u *);
174 static inline void dprint_io_u(struct io_u *io_u, const char *p)
176 struct fio_file *f = io_u->file;
178 dprint(FD_IO, "%s: io_u %p: off=%llu/len=%lu/ddir=%d", p, io_u,
179 (unsigned long long) io_u->offset,
180 io_u->buflen, io_u->ddir);
181 if (fio_debug & (1 << FD_IO)) {
183 log_info("/%s", f->file_name);
189 #define dprint_io_u(io_u, p)