4 #define FIO_IOOPS_VERSION 11
8 IO_U_F_FLIGHT = 1 << 1,
9 IO_U_F_FREE_DEF = 1 << 2,
10 IO_U_F_IN_CUR_DEPTH = 1 << 3,
18 #ifdef FIO_HAVE_LIBAIO
21 #ifdef FIO_HAVE_POSIXAIO
30 #ifdef FIO_HAVE_SOLARISAIO
35 struct timeval start_time;
36 struct timeval issue_time;
39 * Allocated/set buffer and length
43 unsigned long long offset;
46 * IO engine state, may be different from above when we get
47 * partial transfers / residual data counts
50 unsigned long xfer_buflen;
53 * Parameter related to pre-filled buffers and
54 * their size to handle variable block sizes.
56 unsigned long buf_filled_len;
64 * io engine private data
74 struct fio_file *file;
76 struct flist_head list;
79 * Callback for io completion
81 int (*end_io)(struct thread_data *, struct io_u *);
85 * io_ops->queue() return values
88 FIO_Q_COMPLETED = 0, /* completed sync */
89 FIO_Q_QUEUED = 1, /* queued, will complete async */
90 FIO_Q_BUSY = 2, /* no more room, call ->commit() */
94 struct flist_head list;
98 int (*setup)(struct thread_data *);
99 int (*init)(struct thread_data *);
100 int (*prep)(struct thread_data *, struct io_u *);
101 int (*queue)(struct thread_data *, struct io_u *);
102 int (*commit)(struct thread_data *);
103 int (*getevents)(struct thread_data *, unsigned int, unsigned int, struct timespec *);
104 struct io_u *(*event)(struct thread_data *, int);
105 int (*cancel)(struct thread_data *, struct io_u *);
106 void (*cleanup)(struct thread_data *);
107 int (*open_file)(struct thread_data *, struct fio_file *);
108 int (*close_file)(struct thread_data *, struct fio_file *);
109 int (*get_file_size)(struct thread_data *, struct fio_file *);
114 enum fio_ioengine_flags {
115 FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
116 FIO_RAWIO = 1 << 1, /* some sort of direct/raw io */
117 FIO_DISKLESSIO = 1 << 2, /* no disk involved */
118 FIO_NOEXTEND = 1 << 3, /* engine can't extend file */
119 FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
120 FIO_UNIDIR = 1 << 5, /* engine is uni-directional */
121 FIO_NOIO = 1 << 6, /* thread does only pseudo IO */
122 FIO_SIGQUIT = 1 << 7, /* needs SIGQUIT to exit */
123 FIO_PIPEIO = 1 << 8, /* input/output no seekable */
127 * io engine entry points
129 extern int __must_check td_io_init(struct thread_data *);
130 extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
131 extern int __must_check td_io_queue(struct thread_data *, struct io_u *);
132 extern int __must_check td_io_sync(struct thread_data *, struct fio_file *);
133 extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
134 extern int __must_check td_io_commit(struct thread_data *);
135 extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
136 extern int td_io_close_file(struct thread_data *, struct fio_file *);
137 extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
139 extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
140 extern void register_ioengine(struct ioengine_ops *);
141 extern void unregister_ioengine(struct ioengine_ops *);
142 extern void close_ioengine(struct thread_data *);
147 #define queue_full(td) flist_empty(&(td)->io_u_freelist)
148 extern struct io_u *__get_io_u(struct thread_data *);
149 extern struct io_u *get_io_u(struct thread_data *);
150 extern void put_io_u(struct thread_data *, struct io_u *);
151 extern void clear_io_u(struct thread_data *, struct io_u *);
152 extern void requeue_io_u(struct thread_data *, struct io_u **);
153 extern int __must_check io_u_sync_complete(struct thread_data *, struct io_u *, unsigned long *);
154 extern int __must_check io_u_queued_complete(struct thread_data *, int, unsigned long *);
155 extern void io_u_queued(struct thread_data *, struct io_u *);
156 extern void io_u_log_error(struct thread_data *, struct io_u *);
157 extern void io_u_mark_depth(struct thread_data *, unsigned int);
158 extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned int);
159 void io_u_mark_complete(struct thread_data *, unsigned int);
160 void io_u_mark_submit(struct thread_data *, unsigned int);
162 int do_io_u_sync(struct thread_data *, struct io_u *);
165 static inline void dprint_io_u(struct io_u *io_u, const char *p)
167 struct fio_file *f = io_u->file;
169 dprint(FD_IO, "%s: io_u %p: off=%llu/len=%lu/ddir=%d", p, io_u,
170 (unsigned long long) io_u->offset,
171 io_u->buflen, io_u->ddir);
172 if (fio_debug & (1 << FD_IO)) {
174 log_info("/%s", f->file_name);
180 #define dprint_io_u(io_u, p)