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,
19 #ifdef FIO_HAVE_LIBAIO
22 #ifdef FIO_HAVE_POSIXAIO
31 #ifdef FIO_HAVE_SOLARISAIO
36 struct timeval start_time;
37 struct timeval issue_time;
40 * Allocated/set buffer and length
44 unsigned long long offset;
47 * IO engine state, may be different from above when we get
48 * partial transfers / residual data counts
51 unsigned long xfer_buflen;
54 * Parameter related to pre-filled buffers and
55 * their size to handle variable block sizes.
57 unsigned long buf_filled_len;
65 * io engine private data
75 struct fio_file *file;
77 struct flist_head list;
80 * Callback for io completion
82 int (*end_io)(struct thread_data *, struct io_u *);
86 * io_ops->queue() return values
89 FIO_Q_COMPLETED = 0, /* completed sync */
90 FIO_Q_QUEUED = 1, /* queued, will complete async */
91 FIO_Q_BUSY = 2, /* no more room, call ->commit() */
95 struct flist_head list;
99 int (*setup)(struct thread_data *);
100 int (*init)(struct thread_data *);
101 int (*prep)(struct thread_data *, struct io_u *);
102 int (*queue)(struct thread_data *, struct io_u *);
103 int (*commit)(struct thread_data *);
104 int (*getevents)(struct thread_data *, unsigned int, unsigned int, struct timespec *);
105 struct io_u *(*event)(struct thread_data *, int);
106 int (*cancel)(struct thread_data *, struct io_u *);
107 void (*cleanup)(struct thread_data *);
108 int (*open_file)(struct thread_data *, struct fio_file *);
109 int (*close_file)(struct thread_data *, struct fio_file *);
110 int (*get_file_size)(struct thread_data *, struct fio_file *);
115 enum fio_ioengine_flags {
116 FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
117 FIO_RAWIO = 1 << 1, /* some sort of direct/raw io */
118 FIO_DISKLESSIO = 1 << 2, /* no disk involved */
119 FIO_NOEXTEND = 1 << 3, /* engine can't extend file */
120 FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
121 FIO_UNIDIR = 1 << 5, /* engine is uni-directional */
122 FIO_NOIO = 1 << 6, /* thread does only pseudo IO */
123 FIO_SIGQUIT = 1 << 7, /* needs SIGQUIT to exit */
124 FIO_PIPEIO = 1 << 8, /* input/output no seekable */
128 * io engine entry points
130 extern int __must_check td_io_init(struct thread_data *);
131 extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
132 extern int __must_check td_io_queue(struct thread_data *, struct io_u *);
133 extern int __must_check td_io_sync(struct thread_data *, struct fio_file *);
134 extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
135 extern int __must_check td_io_commit(struct thread_data *);
136 extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
137 extern int td_io_close_file(struct thread_data *, struct fio_file *);
138 extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
140 extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
141 extern void register_ioengine(struct ioengine_ops *);
142 extern void unregister_ioengine(struct ioengine_ops *);
143 extern void close_ioengine(struct thread_data *);
148 #define queue_full(td) flist_empty(&(td)->io_u_freelist)
149 extern struct io_u *__get_io_u(struct thread_data *);
150 extern struct io_u *get_io_u(struct thread_data *);
151 extern void put_io_u(struct thread_data *, struct io_u *);
152 extern void clear_io_u(struct thread_data *, struct io_u *);
153 extern void requeue_io_u(struct thread_data *, struct io_u **);
154 extern int __must_check io_u_sync_complete(struct thread_data *, struct io_u *, unsigned long *);
155 extern int __must_check io_u_queued_complete(struct thread_data *, int, unsigned long *);
156 extern void io_u_queued(struct thread_data *, struct io_u *);
157 extern void io_u_log_error(struct thread_data *, struct io_u *);
158 extern void io_u_mark_depth(struct thread_data *, unsigned int);
159 extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned int);
160 void io_u_mark_complete(struct thread_data *, unsigned int);
161 void io_u_mark_submit(struct thread_data *, unsigned int);
163 int do_io_u_sync(struct thread_data *, struct io_u *);
164 int do_io_u_trim(struct thread_data *, struct io_u *);
167 static inline void dprint_io_u(struct io_u *io_u, const char *p)
169 struct fio_file *f = io_u->file;
171 dprint(FD_IO, "%s: io_u %p: off=%llu/len=%lu/ddir=%d", p, io_u,
172 (unsigned long long) io_u->offset,
173 io_u->buflen, io_u->ddir);
174 if (fio_debug & (1 << FD_IO)) {
176 log_info("/%s", f->file_name);
182 #define dprint_io_u(io_u, p)