4 #include "compiler/compiler.h"
17 IO_U_F_FLIGHT = 1 << 1,
18 IO_U_F_NO_FILE_PUT = 1 << 2,
19 IO_U_F_IN_CUR_DEPTH = 1 << 3,
20 IO_U_F_BUSY_OK = 1 << 4,
21 IO_U_F_TRIMMED = 1 << 5,
22 IO_U_F_BARRIER = 1 << 6,
23 IO_U_F_VER_LIST = 1 << 7,
24 IO_U_F_PRIORITY = 1 << 8,
31 struct timespec start_time;
32 struct timespec issue_time;
34 struct fio_file *file;
39 * For replay workloads, we may want to account as a different
40 * IO type than what is being submitted.
42 enum fio_ddir acct_ddir;
47 unsigned short numberio;
50 * Allocated/set buffer and length
52 unsigned long long buflen;
53 unsigned long long offset; /* is really ->xfer_offset... */
54 unsigned long long verify_offset; /* is really ->offset */
58 * Initial seed for generating the buffer contents
63 * IO engine state, may be different from above when we get
64 * partial transfers / residual data counts
67 unsigned long long xfer_buflen;
70 * Parameter related to pre-filled buffers and
71 * their size to handle variable block sizes.
73 unsigned long long buf_filled_len;
77 unsigned long long resid;
81 * io engine private data
90 struct flist_head verify_list;
91 struct workqueue_work work;
95 * ZBD mode zbd_queue_io callback: called after engine->queue operation
96 * to advance a zone write pointer and eventually unlock the I/O zone.
97 * @q indicates the I/O queue status (busy, queued or completed).
98 * @success == true means that the I/O operation has been queued or
99 * completed successfully.
101 void (*zbd_queue_io)(struct thread_data *td, struct io_u *, int q,
105 * ZBD mode zbd_put_io callback: called in after completion of an I/O
106 * or commit of an async I/O to unlock the I/O target zone.
108 void (*zbd_put_io)(struct thread_data *td, const struct io_u *);
111 * Callback for io completion
113 int (*end_io)(struct thread_data *, struct io_u **);
119 #ifdef CONFIG_POSIXAIO
123 struct sg_io_hdr hdr;
125 #ifdef CONFIG_SOLARISAIO
126 aio_result_t resultp;
138 extern struct io_u *__get_io_u(struct thread_data *);
139 extern struct io_u *get_io_u(struct thread_data *);
140 extern void put_io_u(struct thread_data *, struct io_u *);
141 extern void clear_io_u(struct thread_data *, struct io_u *);
142 extern void requeue_io_u(struct thread_data *, struct io_u **);
143 extern int __must_check io_u_sync_complete(struct thread_data *, struct io_u *);
144 extern int __must_check io_u_queued_complete(struct thread_data *, int);
145 extern void io_u_queued(struct thread_data *, struct io_u *);
146 extern int io_u_quiesce(struct thread_data *);
147 extern void io_u_log_error(struct thread_data *, struct io_u *);
148 extern void io_u_mark_depth(struct thread_data *, unsigned int);
149 extern void fill_io_buffer(struct thread_data *, void *, unsigned long long, unsigned long long);
150 extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned long long, unsigned long long);
151 void io_u_mark_complete(struct thread_data *, unsigned int);
152 void io_u_mark_submit(struct thread_data *, unsigned int);
153 bool queue_full(const struct thread_data *);
155 int do_io_u_sync(const struct thread_data *, struct io_u *);
156 int do_io_u_trim(const struct thread_data *, struct io_u *);
159 static inline void dprint_io_u(struct io_u *io_u, const char *p)
161 struct fio_file *f = io_u->file;
164 dprint(FD_IO, "%s: io_u %p: off=0x%llx,len=0x%llx,ddir=%d,file=%s\n",
166 (unsigned long long) io_u->offset,
167 io_u->buflen, io_u->ddir,
170 dprint(FD_IO, "%s: io_u %p: off=0x%llx,len=0x%llx,ddir=%d\n",
172 (unsigned long long) io_u->offset,
173 io_u->buflen, io_u->ddir);
176 #define dprint_io_u(io_u, p)
179 static inline enum fio_ddir acct_ddir(struct io_u *io_u)
181 if (io_u->acct_ddir != -1)
182 return io_u->acct_ddir;
187 #define io_u_clear(td, io_u, val) \
188 td_flags_clear((td), &(io_u->flags), (val))
189 #define io_u_set(td, io_u, val) \
190 td_flags_set((td), &(io_u)->flags, (val))
191 #define io_u_is_prio(io_u) \
192 (io_u->flags & (unsigned int) IO_U_F_PRIORITY) != 0