fio: ioengine flag cleanup
[fio.git] / ioengines.h
CommitLineData
dcefb588
JA
1#ifndef FIO_IOENGINE_H
2#define FIO_IOENGINE_H
3
3d2d14bc
SW
4#include <stddef.h>
5
41666588 6#include "compiler/compiler.h"
3d2d14bc 7#include "flist.h"
8ef89e0b 8#include "io_u.h"
6c5b11d3 9#include "zbd_types.h"
a7e8aae0 10#include "fdp.h"
67bf9823 11
5bd8f742 12#define FIO_IOOPS_VERSION 34
dcefb588 13
5a8a6a03
YK
14#ifndef CONFIG_DYNAMIC_ENGINES
15#define FIO_STATIC static
16#else
17#define FIO_STATIC
18#endif
19
dcefb588
JA
20/*
21 * io_ops->queue() return values
22 */
d3b07186 23enum fio_q_status {
dcefb588
JA
24 FIO_Q_COMPLETED = 0, /* completed sync */
25 FIO_Q_QUEUED = 1, /* queued, will complete async */
26 FIO_Q_BUSY = 2, /* no more room, call ->commit() */
27};
28
29struct ioengine_ops {
30 struct flist_head list;
43072e8e 31 const char *name;
dcefb588
JA
32 int version;
33 int flags;
f6931a1d 34 void *dlhandle;
dcefb588
JA
35 int (*setup)(struct thread_data *);
36 int (*init)(struct thread_data *);
2041bd34 37 int (*post_init)(struct thread_data *);
dcefb588 38 int (*prep)(struct thread_data *, struct io_u *);
d3b07186 39 enum fio_q_status (*queue)(struct thread_data *, struct io_u *);
dcefb588 40 int (*commit)(struct thread_data *);
1f440ece 41 int (*getevents)(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
dcefb588 42 struct io_u *(*event)(struct thread_data *, int);
5ad7be56 43 char *(*errdetails)(struct io_u *);
dcefb588
JA
44 int (*cancel)(struct thread_data *, struct io_u *);
45 void (*cleanup)(struct thread_data *);
46 int (*open_file)(struct thread_data *, struct fio_file *);
47 int (*close_file)(struct thread_data *, struct fio_file *);
d9b100fc 48 int (*invalidate)(struct thread_data *, struct fio_file *);
38ef9c90 49 int (*unlink_file)(struct thread_data *, struct fio_file *);
dcefb588 50 int (*get_file_size)(struct thread_data *, struct fio_file *);
8c47cc76 51 int (*prepopulate_file)(struct thread_data *, struct fio_file *);
36d80bc7 52 void (*terminate)(struct thread_data *);
a6cb85e2
JA
53 int (*iomem_alloc)(struct thread_data *, size_t);
54 void (*iomem_free)(struct thread_data *);
c73ed246
JA
55 int (*io_u_init)(struct thread_data *, struct io_u *);
56 void (*io_u_free)(struct thread_data *, struct io_u *);
6c5b11d3
DLM
57 int (*get_zoned_model)(struct thread_data *td,
58 struct fio_file *f, enum zbd_zoned_model *);
59 int (*report_zones)(struct thread_data *, struct fio_file *,
60 uint64_t, struct zbd_zone *, unsigned int);
61 int (*reset_wp)(struct thread_data *, struct fio_file *,
62 uint64_t, uint64_t);
d2f442bc
NC
63 int (*get_max_open_zones)(struct thread_data *, struct fio_file *,
64 unsigned int *);
9e523ef8
SK
65 int (*get_max_active_zones)(struct thread_data *, struct fio_file *,
66 unsigned int *);
a7f1b5cd
SK
67 int (*finish_zone)(struct thread_data *, struct fio_file *,
68 uint64_t, uint64_t);
a7e8aae0
KB
69 int (*fdp_fetch_ruhs)(struct thread_data *, struct fio_file *,
70 struct fio_ruhs_info *);
de890a1e
SL
71 int option_struct_size;
72 struct fio_option *options;
dcefb588
JA
73};
74
420415dd
VF
75enum {
76 __FIO_SYNCIO = 0, /* io engine has synchronous ->queue */
77 __FIO_RAWIO, /* some sort of direct/raw io */
78 __FIO_DISKLESSIO, /* no disk involved */
79 __FIO_NOEXTEND, /* engine can't extend file */
80 __FIO_NODISKUTIL, /* diskutil can't handle filename */
81 __FIO_UNIDIR, /* engine is uni-directional */
82 __FIO_NOIO, /* thread does only pseudo IO */
83 __FIO_PIPEIO, /* input/output no seekable */
84 __FIO_BARRIER, /* engine supports barriers */
85 __FIO_MEMALIGN, /* engine wants aligned memory */
86 __FIO_BIT_BASED, /* engine uses a bit base (e.g. uses Kbit as opposed to
87 KB) */
88 __FIO_FAKEIO, /* engine pretends to do IO */
89 __FIO_NOSTATS, /* don't do IO stats */
90 __FIO_NOFILEHASH, /* doesn't hash the files for lookup later. */
91 __FIO_ASYNCIO_SYNC_TRIM, /* io engine has async ->queue except for trim */
92 __FIO_NO_OFFLOAD, /* no async offload */
93 __FIO_ASYNCIO_SETS_ISSUE_TIME, /* async ioengine with commit function that sets
94 issue_time */
95 __FIO_SKIPPABLE_IOMEM_ALLOC, /* skip iomem_alloc & iomem_free if job sets mem/iomem */
96 __FIO_RO_NEEDS_RW_OPEN, /* open files in rw mode even if we have a read job; only
f0c8ab1c 97 affects ioengines using generic_open_file */
420415dd
VF
98 __FIO_MULTI_RANGE_TRIM, /* ioengine supports trim with more than one range */
99 __FIO_IOENGINE_F_LAST, /* not a real bit; used to count number of bits */
100};
101
102enum fio_ioengine_flags {
103 FIO_SYNCIO = 1 << __FIO_SYNCIO,
104 FIO_RAWIO = 1 << __FIO_RAWIO,
105 FIO_DISKLESSIO = 1 << __FIO_DISKLESSIO,
106 FIO_NOEXTEND = 1 << __FIO_NOEXTEND,
107 FIO_NODISKUTIL = 1 << __FIO_NODISKUTIL,
108 FIO_UNIDIR = 1 << __FIO_UNIDIR,
109 FIO_NOIO = 1 << __FIO_NOIO,
110 FIO_PIPEIO = 1 << __FIO_PIPEIO,
111 FIO_BARRIER = 1 << __FIO_BARRIER,
112 FIO_MEMALIGN = 1 << __FIO_MEMALIGN,
113 FIO_BIT_BASED = 1 << __FIO_BIT_BASED,
114 FIO_FAKEIO = 1 << __FIO_FAKEIO,
115 FIO_NOSTATS = 1 << __FIO_NOSTATS,
116 FIO_NOFILEHASH = 1 << __FIO_NOFILEHASH,
117 FIO_ASYNCIO_SYNC_TRIM = 1 << __FIO_ASYNCIO_SYNC_TRIM,
118 FIO_NO_OFFLOAD = 1 << __FIO_NO_OFFLOAD,
119 FIO_ASYNCIO_SETS_ISSUE_TIME = 1 << __FIO_ASYNCIO_SETS_ISSUE_TIME,
120 FIO_SKIPPABLE_IOMEM_ALLOC = 1 << __FIO_SKIPPABLE_IOMEM_ALLOC,
121 FIO_RO_NEEDS_RW_OPEN = 1 << __FIO_RO_NEEDS_RW_OPEN,
122 FIO_MULTI_RANGE_TRIM = 1 << __FIO_MULTI_RANGE_TRIM,
2b4f4abe 123};
dcefb588 124
a8075704
DG
125/*
126 * External engine defined symbol to fill in the engine ops structure
127 */
128typedef void (*get_ioengine_t)(struct ioengine_ops **);
129
dcefb588
JA
130/*
131 * io engine entry points
132 */
133extern int __must_check td_io_init(struct thread_data *);
134extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
d3b07186 135extern enum fio_q_status __must_check td_io_queue(struct thread_data *, struct io_u *);
1f440ece 136extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
a80cb54b 137extern void td_io_commit(struct thread_data *);
dcefb588
JA
138extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
139extern int td_io_close_file(struct thread_data *, struct fio_file *);
38ef9c90 140extern int td_io_unlink_file(struct thread_data *, struct fio_file *);
dcefb588
JA
141extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
142
4fedf59a 143extern struct ioengine_ops *load_ioengine(struct thread_data *);
dcefb588
JA
144extern void register_ioengine(struct ioengine_ops *);
145extern void unregister_ioengine(struct ioengine_ops *);
de890a1e 146extern void free_ioengine(struct thread_data *);
dcefb588
JA
147extern void close_ioengine(struct thread_data *);
148
de890a1e
SL
149extern int fio_show_ioengine_help(const char *engine);
150
dcefb588 151#endif