4 #include "compiler/compiler.h"
10 #include "workqueue.h"
21 IO_U_F_FLIGHT = 1 << 1,
22 IO_U_F_NO_FILE_PUT = 1 << 2,
23 IO_U_F_IN_CUR_DEPTH = 1 << 3,
24 IO_U_F_BUSY_OK = 1 << 4,
25 IO_U_F_TRIMMED = 1 << 5,
26 IO_U_F_BARRIER = 1 << 6,
27 IO_U_F_VER_LIST = 1 << 7,
34 struct timespec start_time;
35 struct timespec issue_time;
37 struct fio_file *file;
42 * For replay workloads, we may want to account as a different
43 * IO type than what is being submitted.
45 enum fio_ddir acct_ddir;
50 unsigned short numberio;
53 * Allocated/set buffer and length
56 unsigned long long offset;
60 * Initial seed for generating the buffer contents
65 * IO engine state, may be different from above when we get
66 * partial transfers / residual data counts
69 unsigned long xfer_buflen;
72 * Parameter related to pre-filled buffers and
73 * their size to handle variable block sizes.
75 unsigned long buf_filled_len;
83 * io engine private data
92 struct flist_head verify_list;
93 struct workqueue_work work;
97 * Callback for io completion
99 int (*end_io)(struct thread_data *, struct io_u **);
105 #ifdef CONFIG_POSIXAIO
109 struct sg_io_hdr hdr;
114 #ifdef CONFIG_SOLARISAIO
115 aio_result_t resultp;
117 #ifdef FIO_HAVE_BINJECT
118 struct b_user_cmd buc;
130 extern struct io_u *__get_io_u(struct thread_data *);
131 extern struct io_u *get_io_u(struct thread_data *);
132 extern void put_io_u(struct thread_data *, struct io_u *);
133 extern void clear_io_u(struct thread_data *, struct io_u *);
134 extern void requeue_io_u(struct thread_data *, struct io_u **);
135 extern int __must_check io_u_sync_complete(struct thread_data *, struct io_u *);
136 extern int __must_check io_u_queued_complete(struct thread_data *, int);
137 extern void io_u_queued(struct thread_data *, struct io_u *);
138 extern int io_u_quiesce(struct thread_data *);
139 extern void io_u_log_error(struct thread_data *, struct io_u *);
140 extern void io_u_mark_depth(struct thread_data *, unsigned int);
141 extern void fill_io_buffer(struct thread_data *, void *, unsigned int, unsigned int);
142 extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned int, unsigned int);
143 void io_u_mark_complete(struct thread_data *, unsigned int);
144 void io_u_mark_submit(struct thread_data *, unsigned int);
145 bool queue_full(const struct thread_data *);
147 int do_io_u_sync(const struct thread_data *, struct io_u *);
148 int do_io_u_trim(const struct thread_data *, struct io_u *);
151 static inline void dprint_io_u(struct io_u *io_u, const char *p)
153 struct fio_file *f = io_u->file;
155 dprint(FD_IO, "%s: io_u %p: off=%llu/len=%lu/ddir=%d", p, io_u,
156 (unsigned long long) io_u->offset,
157 io_u->buflen, io_u->ddir);
159 dprint(FD_IO, "/%s", f->file_name);
163 #define dprint_io_u(io_u, p)
166 static inline enum fio_ddir acct_ddir(struct io_u *io_u)
168 if (io_u->acct_ddir != -1)
169 return io_u->acct_ddir;
174 #define io_u_clear(td, io_u, val) \
175 td_flags_clear((td), &(io_u->flags), (val))
176 #define io_u_set(td, io_u, val) \
177 td_flags_set((td), &(io_u)->flags, (val))