6 #include "compiler/compiler.h"
11 #define FIO_IOOPS_VERSION 27
13 #ifndef CONFIG_DYNAMIC_ENGINES
14 #define FIO_STATIC static
20 * io_ops->queue() return values
23 FIO_Q_COMPLETED = 0, /* completed sync */
24 FIO_Q_QUEUED = 1, /* queued, will complete async */
25 FIO_Q_BUSY = 2, /* no more room, call ->commit() */
29 struct flist_head list;
33 int (*setup)(struct thread_data *);
34 int (*init)(struct thread_data *);
35 int (*post_init)(struct thread_data *);
36 int (*prep)(struct thread_data *, struct io_u *);
37 enum fio_q_status (*queue)(struct thread_data *, struct io_u *);
38 int (*commit)(struct thread_data *);
39 int (*getevents)(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
40 struct io_u *(*event)(struct thread_data *, int);
41 char *(*errdetails)(struct io_u *);
42 int (*cancel)(struct thread_data *, struct io_u *);
43 void (*cleanup)(struct thread_data *);
44 int (*open_file)(struct thread_data *, struct fio_file *);
45 int (*close_file)(struct thread_data *, struct fio_file *);
46 int (*invalidate)(struct thread_data *, struct fio_file *);
47 int (*unlink_file)(struct thread_data *, struct fio_file *);
48 int (*get_file_size)(struct thread_data *, struct fio_file *);
49 void (*terminate)(struct thread_data *);
50 int (*iomem_alloc)(struct thread_data *, size_t);
51 void (*iomem_free)(struct thread_data *);
52 int (*io_u_init)(struct thread_data *, struct io_u *);
53 void (*io_u_free)(struct thread_data *, struct io_u *);
54 int (*get_zoned_model)(struct thread_data *td,
55 struct fio_file *f, enum zbd_zoned_model *);
56 int (*report_zones)(struct thread_data *, struct fio_file *,
57 uint64_t, struct zbd_zone *, unsigned int);
58 int (*reset_wp)(struct thread_data *, struct fio_file *,
60 int option_struct_size;
61 struct fio_option *options;
64 enum fio_ioengine_flags {
65 FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
66 FIO_RAWIO = 1 << 1, /* some sort of direct/raw io */
67 FIO_DISKLESSIO = 1 << 2, /* no disk involved */
68 FIO_NOEXTEND = 1 << 3, /* engine can't extend file */
69 FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
70 FIO_UNIDIR = 1 << 5, /* engine is uni-directional */
71 FIO_NOIO = 1 << 6, /* thread does only pseudo IO */
72 FIO_PIPEIO = 1 << 7, /* input/output no seekable */
73 FIO_BARRIER = 1 << 8, /* engine supports barriers */
74 FIO_MEMALIGN = 1 << 9, /* engine wants aligned memory */
75 FIO_BIT_BASED = 1 << 10, /* engine uses a bit base (e.g. uses Kbit as opposed to KB) */
76 FIO_FAKEIO = 1 << 11, /* engine pretends to do IO */
77 FIO_NOSTATS = 1 << 12, /* don't do IO stats */
78 FIO_NOFILEHASH = 1 << 13, /* doesn't hash the files for lookup later. */
80 = 1 << 14, /* io engine has async ->queue except for trim */
81 FIO_NO_OFFLOAD = 1 << 15, /* no async offload */
85 * External engine defined symbol to fill in the engine ops structure
87 typedef void (*get_ioengine_t)(struct ioengine_ops **);
90 * io engine entry points
92 extern int __must_check td_io_init(struct thread_data *);
93 extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
94 extern enum fio_q_status __must_check td_io_queue(struct thread_data *, struct io_u *);
95 extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
96 extern void td_io_commit(struct thread_data *);
97 extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
98 extern int td_io_close_file(struct thread_data *, struct fio_file *);
99 extern int td_io_unlink_file(struct thread_data *, struct fio_file *);
100 extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
102 extern struct ioengine_ops *load_ioengine(struct thread_data *);
103 extern void register_ioengine(struct ioengine_ops *);
104 extern void unregister_ioengine(struct ioengine_ops *);
105 extern void free_ioengine(struct thread_data *);
106 extern void close_ioengine(struct thread_data *);
108 extern int fio_show_ioengine_help(const char *engine);