forked from axboe/fio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ioengines.h
90 lines (80 loc) · 3.41 KB
/
ioengines.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef FIO_IOENGINE_H
#define FIO_IOENGINE_H
#include "compiler/compiler.h"
#include "os/os.h"
#include "file.h"
#include "io_u.h"
#define FIO_IOOPS_VERSION 23
/*
* io_ops->queue() return values
*/
enum {
FIO_Q_COMPLETED = 0, /* completed sync */
FIO_Q_QUEUED = 1, /* queued, will complete async */
FIO_Q_BUSY = 2, /* no more room, call ->commit() */
};
struct ioengine_ops {
struct flist_head list;
const char *name;
int version;
int flags;
int (*setup)(struct thread_data *);
int (*init)(struct thread_data *);
int (*prep)(struct thread_data *, struct io_u *);
int (*queue)(struct thread_data *, struct io_u *);
int (*commit)(struct thread_data *);
int (*getevents)(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
struct io_u *(*event)(struct thread_data *, int);
char *(*errdetails)(struct io_u *);
int (*cancel)(struct thread_data *, struct io_u *);
void (*cleanup)(struct thread_data *);
int (*open_file)(struct thread_data *, struct fio_file *);
int (*close_file)(struct thread_data *, struct fio_file *);
int (*invalidate)(struct thread_data *, struct fio_file *);
int (*unlink_file)(struct thread_data *, struct fio_file *);
int (*get_file_size)(struct thread_data *, struct fio_file *);
void (*terminate)(struct thread_data *);
int (*iomem_alloc)(struct thread_data *, size_t);
void (*iomem_free)(struct thread_data *);
int (*io_u_init)(struct thread_data *, struct io_u *);
void (*io_u_free)(struct thread_data *, struct io_u *);
int option_struct_size;
struct fio_option *options;
};
enum fio_ioengine_flags {
FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
FIO_RAWIO = 1 << 1, /* some sort of direct/raw io */
FIO_DISKLESSIO = 1 << 2, /* no disk involved */
FIO_NOEXTEND = 1 << 3, /* engine can't extend file */
FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
FIO_UNIDIR = 1 << 5, /* engine is uni-directional */
FIO_NOIO = 1 << 6, /* thread does only pseudo IO */
FIO_PIPEIO = 1 << 7, /* input/output no seekable */
FIO_BARRIER = 1 << 8, /* engine supports barriers */
FIO_MEMALIGN = 1 << 9, /* engine wants aligned memory */
FIO_BIT_BASED = 1 << 10, /* engine uses a bit base (e.g. uses Kbit as opposed to KB) */
FIO_FAKEIO = 1 << 11, /* engine pretends to do IO */
};
/*
* External engine defined symbol to fill in the engine ops structure
*/
typedef void (*get_ioengine_t)(struct ioengine_ops **);
/*
* io engine entry points
*/
extern int __must_check td_io_init(struct thread_data *);
extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
extern int __must_check td_io_queue(struct thread_data *, struct io_u *);
extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
extern int __must_check td_io_commit(struct thread_data *);
extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
extern int td_io_close_file(struct thread_data *, struct fio_file *);
extern int td_io_unlink_file(struct thread_data *, struct fio_file *);
extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
extern struct ioengine_ops *load_ioengine(struct thread_data *);
extern void register_ioengine(struct ioengine_ops *);
extern void unregister_ioengine(struct ioengine_ops *);
extern void free_ioengine(struct thread_data *);
extern void close_ioengine(struct thread_data *);
extern int fio_show_ioengine_help(const char *engine);
#endif