From d3b07186b1d4c7c1d9adc1306407458ce41ad048 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 17 Apr 2018 10:04:15 -0700 Subject: [PATCH] Introduce enum fio_q_status Introduce a new enumeration type fio_q_status. This patch does not change any functionality but makes it clear which variables and return values represent a queuing status value. Bump FIO_IOOPS_VERSION because this patch changes the I/O engine API. Signed-off-by: Bart Van Assche --- backend.c | 4 ++-- engines/cpu.c | 3 ++- engines/dev-dax.c | 3 ++- engines/e4defrag.c | 3 ++- engines/falloc.c | 3 ++- engines/filecreate.c | 3 ++- engines/ftruncate.c | 3 ++- engines/fusion-aw.c | 2 +- engines/glusterfs_async.c | 4 ++-- engines/glusterfs_sync.c | 2 +- engines/guasi.c | 3 ++- engines/libaio.c | 3 ++- engines/libhdfs.c | 3 ++- engines/libpmem.c | 3 ++- engines/mmap.c | 3 ++- engines/mtd.c | 3 ++- engines/net.c | 7 ++++--- engines/null.c | 7 ++++--- engines/pmemblk.c | 3 ++- engines/posixaio.c | 4 ++-- engines/rados.c | 3 ++- engines/rbd.c | 3 ++- engines/rdma.c | 3 ++- engines/sg.c | 8 +++++--- engines/skeleton_external.c | 3 ++- engines/splice.c | 3 ++- engines/sync.c | 15 ++++++++++----- engines/windowsaio.c | 3 ++- ioengines.c | 4 ++-- ioengines.h | 8 ++++---- 30 files changed, 75 insertions(+), 47 deletions(-) diff --git a/backend.c b/backend.c index 3774df58..d5cb6ef5 100644 --- a/backend.c +++ b/backend.c @@ -268,7 +268,7 @@ static void cleanup_pending_aio(struct thread_data *td) static bool fio_io_sync(struct thread_data *td, struct fio_file *f) { struct io_u *io_u = __get_io_u(td); - int ret; + enum fio_q_status ret; if (!io_u) return true; @@ -598,7 +598,7 @@ static bool in_flight_overlap(struct io_u_queue *q, struct io_u *io_u) return overlap; } -static int io_u_submit(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status io_u_submit(struct thread_data *td, struct io_u *io_u) { /* * Check for overlap if the user asked us to, and we have diff --git a/engines/cpu.c b/engines/cpu.c index d0b4a895..37f9bbad 100644 --- a/engines/cpu.c +++ b/engines/cpu.c @@ -53,7 +53,8 @@ static struct fio_option options[] = { }; -static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u) +static enum fio_q_status +fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u) { struct cpu_options *co = td->eo; diff --git a/engines/dev-dax.c b/engines/dev-dax.c index caae1e09..807d8505 100644 --- a/engines/dev-dax.c +++ b/engines/dev-dax.c @@ -182,7 +182,8 @@ done: return 0; } -static int fio_devdax_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_devdax_queue(struct thread_data *td, struct io_u *io_u) { fio_ro_check(td, io_u); io_u->error = 0; diff --git a/engines/e4defrag.c b/engines/e4defrag.c index 3619450d..22d52312 100644 --- a/engines/e4defrag.c +++ b/engines/e4defrag.c @@ -127,7 +127,8 @@ static void fio_e4defrag_cleanup(struct thread_data *td) } -static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u) { int ret; diff --git a/engines/falloc.c b/engines/falloc.c index bb3ac850..a1f6a242 100644 --- a/engines/falloc.c +++ b/engines/falloc.c @@ -66,7 +66,8 @@ open_again: #ifndef FALLOC_FL_PUNCH_HOLE #define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ #endif -static int fio_fallocate_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_fallocate_queue(struct thread_data *td, struct io_u *io_u) { struct fio_file *f = io_u->file; int ret; diff --git a/engines/filecreate.c b/engines/filecreate.c index 6fa041cd..fb3f3897 100644 --- a/engines/filecreate.c +++ b/engines/filecreate.c @@ -55,7 +55,8 @@ static int open_file(struct thread_data *td, struct fio_file *f) return 0; } -static int queue_io(struct thread_data *td, struct io_u fio_unused *io_u) +static enum fio_q_status +queue_io(struct thread_data *td, struct io_u fio_unused *io_u) { return FIO_Q_COMPLETED; } diff --git a/engines/ftruncate.c b/engines/ftruncate.c index 14e115f2..4ff511ea 100644 --- a/engines/ftruncate.c +++ b/engines/ftruncate.c @@ -11,7 +11,8 @@ #include "../fio.h" -static int fio_ftruncate_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_ftruncate_queue(struct thread_data *td, struct io_u *io_u) { struct fio_file *f = io_u->file; int ret; diff --git a/engines/fusion-aw.c b/engines/fusion-aw.c index 77844ffe..eb5fdf50 100644 --- a/engines/fusion-aw.c +++ b/engines/fusion-aw.c @@ -34,7 +34,7 @@ struct fas_data { size_t sector_size; }; -static int queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status queue(struct thread_data *td, struct io_u *io_u) { struct fas_data *d = FILE_ENG_DATA(io_u->file); int rc; diff --git a/engines/glusterfs_async.c b/engines/glusterfs_async.c index eb8df453..9e1c4bf0 100644 --- a/engines/glusterfs_async.c +++ b/engines/glusterfs_async.c @@ -93,8 +93,8 @@ static void gf_async_cb(glfs_fd_t * fd, ssize_t ret, void *data) iou->io_complete = 1; } -static int fio_gf_async_queue(struct thread_data fio_unused * td, - struct io_u *io_u) +static enum fio_q_status fio_gf_async_queue(struct thread_data fio_unused * td, + struct io_u *io_u) { struct gf_data *g = td->io_ops_data; int r; diff --git a/engines/glusterfs_sync.c b/engines/glusterfs_sync.c index 5a145bd8..a10e0ed6 100644 --- a/engines/glusterfs_sync.c +++ b/engines/glusterfs_sync.c @@ -29,7 +29,7 @@ static int fio_gf_prep(struct thread_data *td, struct io_u *io_u) return 0; } -static int fio_gf_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status fio_gf_queue(struct thread_data *td, struct io_u *io_u) { struct gf_data *g = td->io_ops_data; int ret = 0; diff --git a/engines/guasi.c b/engines/guasi.c index 9644ee59..4d332908 100644 --- a/engines/guasi.c +++ b/engines/guasi.c @@ -113,7 +113,8 @@ static int fio_guasi_getevents(struct thread_data *td, unsigned int min, return n; } -static int fio_guasi_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_guasi_queue(struct thread_data *td, struct io_u *io_u) { struct guasi_data *ld = td->io_ops_data; diff --git a/engines/libaio.c b/engines/libaio.c index 7d59df38..0e2263a7 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -177,7 +177,8 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min, return r < 0 ? r : events; } -static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_libaio_queue(struct thread_data *td, struct io_u *io_u) { struct libaio_data *ld = td->io_ops_data; diff --git a/engines/libhdfs.c b/engines/libhdfs.c index 96a0871d..37694faf 100644 --- a/engines/libhdfs.c +++ b/engines/libhdfs.c @@ -165,7 +165,8 @@ static int fio_hdfsio_prep(struct thread_data *td, struct io_u *io_u) return 0; } -static int fio_hdfsio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_hdfsio_queue(struct thread_data *td, struct io_u *io_u) { struct hdfsio_data *hd = td->io_ops_data; struct hdfsio_options *options = td->eo; diff --git a/engines/libpmem.c b/engines/libpmem.c index dbb3f5c6..c3abe2a0 100644 --- a/engines/libpmem.c +++ b/engines/libpmem.c @@ -457,7 +457,8 @@ done: return 0; } -static int fio_libpmem_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_libpmem_queue(struct thread_data *td, struct io_u *io_u) { fio_ro_check(td, io_u); io_u->error = 0; diff --git a/engines/mmap.c b/engines/mmap.c index 9dbefc82..856547be 100644 --- a/engines/mmap.c +++ b/engines/mmap.c @@ -177,7 +177,8 @@ done: return 0; } -static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_mmapio_queue(struct thread_data *td, struct io_u *io_u) { struct fio_file *f = io_u->file; struct fio_mmap_data *fmd = FILE_ENG_DATA(f); diff --git a/engines/mtd.c b/engines/mtd.c index 5f822fc1..9e154836 100644 --- a/engines/mtd.c +++ b/engines/mtd.c @@ -71,7 +71,8 @@ static int fio_mtd_is_bad(struct thread_data *td, return ret; } -static int fio_mtd_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_mtd_queue(struct thread_data *td, struct io_u *io_u) { struct fio_file *f = io_u->file; struct fio_mtd_data *fmd = FILE_ENG_DATA(f); diff --git a/engines/net.c b/engines/net.c index 4540e0e4..8c25c4e5 100644 --- a/engines/net.c +++ b/engines/net.c @@ -642,8 +642,8 @@ static int fio_netio_recv(struct thread_data *td, struct io_u *io_u) return ret; } -static int __fio_netio_queue(struct thread_data *td, struct io_u *io_u, - enum fio_ddir ddir) +static enum fio_q_status +__fio_netio_queue(struct thread_data *td, struct io_u *io_u, enum fio_ddir ddir) { struct netio_data *nd = td->io_ops_data; struct netio_options *o = td->eo; @@ -687,7 +687,8 @@ static int __fio_netio_queue(struct thread_data *td, struct io_u *io_u, return FIO_Q_COMPLETED; } -static int fio_netio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_netio_queue(struct thread_data *td, struct io_u *io_u) { struct netio_options *o = td->eo; int ret; diff --git a/engines/null.c b/engines/null.c index 8c26ad71..b1718e5c 100644 --- a/engines/null.c +++ b/engines/null.c @@ -56,8 +56,8 @@ static int null_commit(struct thread_data *td, struct null_data *nd) return 0; } -static int null_queue(struct thread_data *td, struct null_data *nd, - struct io_u *io_u) +static enum fio_q_status +null_queue(struct thread_data *td, struct null_data *nd, struct io_u *io_u) { fio_ro_check(td, io_u); @@ -118,7 +118,8 @@ static int fio_null_commit(struct thread_data *td) return null_commit(td, td->io_ops_data); } -static int fio_null_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_null_queue(struct thread_data *td, struct io_u *io_u) { return null_queue(td, td->io_ops_data, io_u); } diff --git a/engines/pmemblk.c b/engines/pmemblk.c index 264eb713..e2c55892 100644 --- a/engines/pmemblk.c +++ b/engines/pmemblk.c @@ -342,7 +342,8 @@ static int fio_pmemblk_get_file_size(struct thread_data *td, struct fio_file *f) return 0; } -static int fio_pmemblk_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_pmemblk_queue(struct thread_data *td, struct io_u *io_u) { struct fio_file *f = io_u->file; fio_pmemblk_file_t pmb = FILE_ENG_DATA(f); diff --git a/engines/posixaio.c b/engines/posixaio.c index bddb1ec3..4ac01957 100644 --- a/engines/posixaio.c +++ b/engines/posixaio.c @@ -166,8 +166,8 @@ static struct io_u *fio_posixaio_event(struct thread_data *td, int event) return pd->aio_events[event]; } -static int fio_posixaio_queue(struct thread_data *td, - struct io_u *io_u) +static enum fio_q_status fio_posixaio_queue(struct thread_data *td, + struct io_u *io_u) { struct posixaio_data *pd = td->io_ops_data; os_aiocb_t *aiocb = &io_u->aiocb; diff --git a/engines/rados.c b/engines/rados.c index dc0d7b1e..f3795c57 100644 --- a/engines/rados.c +++ b/engines/rados.c @@ -251,7 +251,8 @@ static void fio_rados_cleanup(struct thread_data *td) } } -static int fio_rados_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_rados_queue(struct thread_data *td, struct io_u *io_u) { struct rados_data *rados = td->io_ops_data; struct fio_rados_iou *fri = io_u->engine_data; diff --git a/engines/rbd.c b/engines/rbd.c index 6582b06d..cf7337f0 100644 --- a/engines/rbd.c +++ b/engines/rbd.c @@ -462,7 +462,8 @@ static int fio_rbd_getevents(struct thread_data *td, unsigned int min, return events; } -static int fio_rbd_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_rbd_queue(struct thread_data *td, struct io_u *io_u) { struct rbd_data *rbd = td->io_ops_data; struct fio_rbd_iou *fri = io_u->engine_data; diff --git a/engines/rdma.c b/engines/rdma.c index 8def6eba..67c5aa7e 100644 --- a/engines/rdma.c +++ b/engines/rdma.c @@ -791,7 +791,8 @@ static int fio_rdmaio_recv(struct thread_data *td, struct io_u **io_us, return i; } -static int fio_rdmaio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_rdmaio_queue(struct thread_data *td, struct io_u *io_u) { struct rdmaio_data *rd = td->io_ops_data; diff --git a/engines/sg.c b/engines/sg.c index c2c0de39..56e5d18a 100644 --- a/engines/sg.c +++ b/engines/sg.c @@ -236,8 +236,9 @@ re_read: return r; } -static int fio_sgio_ioctl_doio(struct thread_data *td, - struct fio_file *f, struct io_u *io_u) +static enum fio_q_status +fio_sgio_ioctl_doio(struct thread_data *td, struct fio_file *f, + struct io_u *io_u) { struct sgio_data *sd = td->io_ops_data; struct sg_io_hdr *hdr = &io_u->hdr; @@ -377,7 +378,8 @@ static int fio_sgio_prep(struct thread_data *td, struct io_u *io_u) return 0; } -static int fio_sgio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_sgio_queue(struct thread_data *td, struct io_u *io_u) { struct sg_io_hdr *hdr = &io_u->hdr; int ret, do_sync = 0; diff --git a/engines/skeleton_external.c b/engines/skeleton_external.c index 56f89f95..7e08afbb 100644 --- a/engines/skeleton_external.c +++ b/engines/skeleton_external.c @@ -90,7 +90,8 @@ static int fio_skeleton_cancel(struct thread_data *td, struct io_u *io_u) * io_u->xfer_buflen. Residual data count may be set in io_u->resid * for a short read/write. */ -static int fio_skeleton_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_skeleton_queue(struct thread_data *td, struct io_u *io_u) { /* * Double sanity check to catch errant write on a readonly setup diff --git a/engines/splice.c b/engines/splice.c index 08fc8574..18403608 100644 --- a/engines/splice.c +++ b/engines/splice.c @@ -199,7 +199,8 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u) return io_u->xfer_buflen; } -static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_spliceio_queue(struct thread_data *td, struct io_u *io_u) { struct spliceio_data *sd = td->io_ops_data; int ret = 0; diff --git a/engines/sync.c b/engines/sync.c index d5b4012f..722320ef 100644 --- a/engines/sync.c +++ b/engines/sync.c @@ -110,7 +110,8 @@ static int fio_io_end(struct thread_data *td, struct io_u *io_u, int ret) } #ifdef CONFIG_PWRITEV -static int fio_pvsyncio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_pvsyncio_queue(struct thread_data *td, struct io_u *io_u) { struct syncio_data *sd = td->io_ops_data; struct iovec *iov = &sd->iovecs[0]; @@ -137,7 +138,8 @@ static int fio_pvsyncio_queue(struct thread_data *td, struct io_u *io_u) #endif #ifdef FIO_HAVE_PWRITEV2 -static int fio_pvsyncio2_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_pvsyncio2_queue(struct thread_data *td, struct io_u *io_u) { struct syncio_data *sd = td->io_ops_data; struct psyncv2_options *o = td->eo; @@ -169,7 +171,8 @@ static int fio_pvsyncio2_queue(struct thread_data *td, struct io_u *io_u) #endif -static int fio_psyncio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_psyncio_queue(struct thread_data *td, struct io_u *io_u) { struct fio_file *f = io_u->file; int ret; @@ -189,7 +192,8 @@ static int fio_psyncio_queue(struct thread_data *td, struct io_u *io_u) return fio_io_end(td, io_u, ret); } -static int fio_syncio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_syncio_queue(struct thread_data *td, struct io_u *io_u) { struct fio_file *f = io_u->file; int ret; @@ -260,7 +264,8 @@ static void fio_vsyncio_set_iov(struct syncio_data *sd, struct io_u *io_u, sd->queued++; } -static int fio_vsyncio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_vsyncio_queue(struct thread_data *td, struct io_u *io_u) { struct syncio_data *sd = td->io_ops_data; diff --git a/engines/windowsaio.c b/engines/windowsaio.c index 94393931..2b932f71 100644 --- a/engines/windowsaio.c +++ b/engines/windowsaio.c @@ -354,7 +354,8 @@ static int fio_windowsaio_getevents(struct thread_data *td, unsigned int min, return dequeued; } -static int fio_windowsaio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status +fio_windowsaio_queue(struct thread_data *td, struct io_u *io_u) { struct fio_overlapped *o = io_u->engine_data; LPOVERLAPPED lpOvl = &o->o; diff --git a/ioengines.c b/ioengines.c index 1d86848e..6ffd27f1 100644 --- a/ioengines.c +++ b/ioengines.c @@ -276,11 +276,11 @@ out: return r; } -int td_io_queue(struct thread_data *td, struct io_u *io_u) +enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u) { const enum fio_ddir ddir = acct_ddir(io_u); unsigned long buflen = io_u->xfer_buflen; - int ret; + enum fio_q_status ret; dprint_io_u(io_u, "queue"); fio_ro_check(td, io_u); diff --git a/ioengines.h b/ioengines.h index 7d265e74..feb21db8 100644 --- a/ioengines.h +++ b/ioengines.h @@ -7,12 +7,12 @@ #include "flist.h" #include "io_u.h" -#define FIO_IOOPS_VERSION 23 +#define FIO_IOOPS_VERSION 24 /* * io_ops->queue() return values */ -enum { +enum fio_q_status { FIO_Q_COMPLETED = 0, /* completed sync */ FIO_Q_QUEUED = 1, /* queued, will complete async */ FIO_Q_BUSY = 2, /* no more room, call ->commit() */ @@ -26,7 +26,7 @@ struct ioengine_ops { 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 *); + enum fio_q_status (*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); @@ -74,7 +74,7 @@ typedef void (*get_ioengine_t)(struct ioengine_ops **); */ 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 enum fio_q_status __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 void td_io_commit(struct thread_data *); extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *); -- 2.25.1