|
Packit |
8930e1 |
#ifndef FIO_IOENGINE_H
|
|
Packit |
8930e1 |
#define FIO_IOENGINE_H
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
#include <stddef.h>
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
#include "compiler/compiler.h"
|
|
Packit |
8930e1 |
#include "flist.h"
|
|
Packit |
8930e1 |
#include "io_u.h"
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
#define FIO_IOOPS_VERSION 25
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
/*
|
|
Packit |
8930e1 |
* io_ops->queue() return values
|
|
Packit |
8930e1 |
*/
|
|
Packit |
8930e1 |
enum fio_q_status {
|
|
Packit |
8930e1 |
FIO_Q_COMPLETED = 0, /* completed sync */
|
|
Packit |
8930e1 |
FIO_Q_QUEUED = 1, /* queued, will complete async */
|
|
Packit |
8930e1 |
FIO_Q_BUSY = 2, /* no more room, call ->commit() */
|
|
Packit |
8930e1 |
};
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
struct ioengine_ops {
|
|
Packit |
8930e1 |
struct flist_head list;
|
|
Packit |
8930e1 |
const char *name;
|
|
Packit |
8930e1 |
int version;
|
|
Packit |
8930e1 |
int flags;
|
|
Packit |
8930e1 |
int (*setup)(struct thread_data *);
|
|
Packit |
8930e1 |
int (*init)(struct thread_data *);
|
|
Packit |
8930e1 |
int (*post_init)(struct thread_data *);
|
|
Packit |
8930e1 |
int (*prep)(struct thread_data *, struct io_u *);
|
|
Packit |
8930e1 |
enum fio_q_status (*queue)(struct thread_data *, struct io_u *);
|
|
Packit |
8930e1 |
int (*commit)(struct thread_data *);
|
|
Packit |
8930e1 |
int (*getevents)(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
|
|
Packit |
8930e1 |
struct io_u *(*event)(struct thread_data *, int);
|
|
Packit |
8930e1 |
char *(*errdetails)(struct io_u *);
|
|
Packit |
8930e1 |
int (*cancel)(struct thread_data *, struct io_u *);
|
|
Packit |
8930e1 |
void (*cleanup)(struct thread_data *);
|
|
Packit |
8930e1 |
int (*open_file)(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
int (*close_file)(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
int (*invalidate)(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
int (*unlink_file)(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
int (*get_file_size)(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
void (*terminate)(struct thread_data *);
|
|
Packit |
8930e1 |
int (*iomem_alloc)(struct thread_data *, size_t);
|
|
Packit |
8930e1 |
void (*iomem_free)(struct thread_data *);
|
|
Packit |
8930e1 |
int (*io_u_init)(struct thread_data *, struct io_u *);
|
|
Packit |
8930e1 |
void (*io_u_free)(struct thread_data *, struct io_u *);
|
|
Packit |
8930e1 |
int option_struct_size;
|
|
Packit |
8930e1 |
struct fio_option *options;
|
|
Packit |
8930e1 |
};
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
enum fio_ioengine_flags {
|
|
Packit |
8930e1 |
FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
|
|
Packit |
8930e1 |
FIO_RAWIO = 1 << 1, /* some sort of direct/raw io */
|
|
Packit |
8930e1 |
FIO_DISKLESSIO = 1 << 2, /* no disk involved */
|
|
Packit |
8930e1 |
FIO_NOEXTEND = 1 << 3, /* engine can't extend file */
|
|
Packit |
8930e1 |
FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
|
|
Packit |
8930e1 |
FIO_UNIDIR = 1 << 5, /* engine is uni-directional */
|
|
Packit |
8930e1 |
FIO_NOIO = 1 << 6, /* thread does only pseudo IO */
|
|
Packit |
8930e1 |
FIO_PIPEIO = 1 << 7, /* input/output no seekable */
|
|
Packit |
8930e1 |
FIO_BARRIER = 1 << 8, /* engine supports barriers */
|
|
Packit |
8930e1 |
FIO_MEMALIGN = 1 << 9, /* engine wants aligned memory */
|
|
Packit |
8930e1 |
FIO_BIT_BASED = 1 << 10, /* engine uses a bit base (e.g. uses Kbit as opposed to KB) */
|
|
Packit |
8930e1 |
FIO_FAKEIO = 1 << 11, /* engine pretends to do IO */
|
|
Packit |
8930e1 |
FIO_NOSTATS = 1 << 12, /* don't do IO stats */
|
|
Packit |
8930e1 |
FIO_NOFILEHASH = 1 << 13, /* doesn't hash the files for lookup later. */
|
|
Packit |
8930e1 |
FIO_ASYNCIO_SYNC_TRIM
|
|
Packit |
8930e1 |
= 1 << 14 /* io engine has async ->queue except for trim */
|
|
Packit |
8930e1 |
};
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
/*
|
|
Packit |
8930e1 |
* External engine defined symbol to fill in the engine ops structure
|
|
Packit |
8930e1 |
*/
|
|
Packit |
8930e1 |
typedef void (*get_ioengine_t)(struct ioengine_ops **);
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
/*
|
|
Packit |
8930e1 |
* io engine entry points
|
|
Packit |
8930e1 |
*/
|
|
Packit |
8930e1 |
extern int __must_check td_io_init(struct thread_data *);
|
|
Packit |
8930e1 |
extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
|
|
Packit |
8930e1 |
extern enum fio_q_status __must_check td_io_queue(struct thread_data *, struct io_u *);
|
|
Packit |
8930e1 |
extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
|
|
Packit |
8930e1 |
extern void td_io_commit(struct thread_data *);
|
|
Packit |
8930e1 |
extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
extern int td_io_close_file(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
extern int td_io_unlink_file(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
extern int __must_check td_io_get_file_size(struct thread_data *, struct fio_file *);
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
extern struct ioengine_ops *load_ioengine(struct thread_data *);
|
|
Packit |
8930e1 |
extern void register_ioengine(struct ioengine_ops *);
|
|
Packit |
8930e1 |
extern void unregister_ioengine(struct ioengine_ops *);
|
|
Packit |
8930e1 |
extern void free_ioengine(struct thread_data *);
|
|
Packit |
8930e1 |
extern void close_ioengine(struct thread_data *);
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
extern int fio_show_ioengine_help(const char *engine);
|
|
Packit |
8930e1 |
|
|
Packit |
8930e1 |
#endif
|