4 #define FIO_IOOPS_VERSION 13
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;
44 struct timeval start_time;
45 struct timeval issue_time;
48 * Allocated/set buffer and length
52 unsigned long long offset;
55 * Initial seed for generating the buffer contents
57 unsigned long rand_seed;
60 * IO engine state, may be different from above when we get
61 * partial transfers / residual data counts
64 unsigned long xfer_buflen;
67 * Parameter related to pre-filled buffers and
68 * their size to handle variable block sizes.
70 unsigned long buf_filled_len;
78 * io engine private data
88 struct fio_file *file;
90 struct flist_head list;
93 * Callback for io completion
95 int (*end_io)(struct thread_data *, struct io_u *);
99 * io_ops->queue() return values
102 FIO_Q_COMPLETED = 0, /* completed sync */
103 FIO_Q_QUEUED = 1, /* queued, will complete async */
104 FIO_Q_BUSY = 2, /* no more room, call ->commit() */
107 struct ioengine_ops {
108 struct flist_head list;
112 int (*setup)(struct thread_data *);
113 int (*init)(struct thread_data *);
114 int (*prep)(struct thread_data *, struct io_u *);
115 int (*queue)(struct thread_data *, struct io_u *);
116 int (*commit)(struct thread_data *);
117 int (*getevents)(struct thread_data *, unsigned int, unsigned int, struct timespec *);
118 struct io_u *(*event)(struct thread_data *, int);
119 int (*cancel)(struct thread_data *, struct io_u *);
120 void (*cleanup)(struct thread_data *);
121 int (*open_file)(struct thread_data *, struct fio_file *);
122 int (*close_file)(struct thread_data *, struct fio_file *);
123 int (*get_file_size)(struct thread_data *, struct fio_file *);
124 int option_struct_size;
125 struct fio_option *options;
130 enum fio_ioengine_flags {
131 FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
132 FIO_RAWIO = 1 << 1, /* some sort of direct/raw io */
133 FIO_DISKLESSIO = 1 << 2, /* no disk involved */
134 FIO_NOEXTEND = 1 << 3, /* engine can't extend file */
135 FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
136 FIO_UNIDIR = 1 << 5, /* engine is uni-directional */
137 FIO_NOIO = 1 << 6, /* thread does only pseudo IO */
138 FIO_SIGTERM = 1 << 7, /* needs SIGTERM to exit */
139 FIO_PIPEIO = 1 << 8, /* input/output no seekable */
140 FIO_BARRIER = 1 << 9, /* engine supports barriers */
141 FIO_MEMALIGN = 1 << 10, /* engine wants aligned memory */
145 * io engine entry points
147 extern int __must_check td_io_init(struct thread_data *);
148 extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
149 extern int __must_check td_io_queue(struct thread_data *, struct io_u *);
150 extern int __must_check td_io_sync(struct thread_data *, struct fio_file *);
151 extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
152 extern int __must_check td_io_commit(struct thread_data *);
153 extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
154 extern int td_io_close_file(struct thread_data *, struct fio_file *);
155 extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
157 extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
158 extern void register_ioengine(struct ioengine_ops *);
159 extern void unregister_ioengine(struct ioengine_ops *);
160 extern void free_ioengine(struct thread_data *);
161 extern void close_ioengine(struct thread_data *);
163 extern int fio_show_ioengine_help(const char *engine);
168 #define queue_full(td) flist_empty(&(td)->io_u_freelist)
169 extern struct io_u *__get_io_u(struct thread_data *);
170 extern struct io_u *get_io_u(struct thread_data *);
171 extern void put_io_u(struct thread_data *, struct io_u *);
172 extern void clear_io_u(struct thread_data *, struct io_u *);
173 extern void requeue_io_u(struct thread_data *, struct io_u **);
174 extern int __must_check io_u_sync_complete(struct thread_data *, struct io_u *, unsigned long *);
175 extern int __must_check io_u_queued_complete(struct thread_data *, int, unsigned long *);
176 extern void io_u_queued(struct thread_data *, struct io_u *);
177 extern void io_u_log_error(struct thread_data *, struct io_u *);
178 extern void io_u_mark_depth(struct thread_data *, unsigned int);
179 extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned int);
180 void io_u_mark_complete(struct thread_data *, unsigned int);
181 void io_u_mark_submit(struct thread_data *, unsigned int);
183 int do_io_u_sync(struct thread_data *, struct io_u *);
184 int do_io_u_trim(struct thread_data *, struct io_u *);
187 static inline void dprint_io_u(struct io_u *io_u, const char *p)
189 struct fio_file *f = io_u->file;
191 dprint(FD_IO, "%s: io_u %p: off=%llu/len=%lu/ddir=%d", p, io_u,
192 (unsigned long long) io_u->offset,
193 io_u->buflen, io_u->ddir);
194 if (fio_debug & (1 << FD_IO)) {
196 log_info("/%s", f->file_name);
202 #define dprint_io_u(io_u, p)