Introduce enum fio_q_status
authorBart Van Assche <bart.vanassche@wdc.com>
Tue, 17 Apr 2018 17:04:15 +0000 (10:04 -0700)
committerBart Van Assche <bart.vanassche@wdc.com>
Wed, 18 Apr 2018 20:25:30 +0000 (13:25 -0700)
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 <bart.vanassche@wdc.com>
30 files changed:
backend.c
engines/cpu.c
engines/dev-dax.c
engines/e4defrag.c
engines/falloc.c
engines/filecreate.c
engines/ftruncate.c
engines/fusion-aw.c
engines/glusterfs_async.c
engines/glusterfs_sync.c
engines/guasi.c
engines/libaio.c
engines/libhdfs.c
engines/libpmem.c
engines/mmap.c
engines/mtd.c
engines/net.c
engines/null.c
engines/pmemblk.c
engines/posixaio.c
engines/rados.c
engines/rbd.c
engines/rdma.c
engines/sg.c
engines/skeleton_external.c
engines/splice.c
engines/sync.c
engines/windowsaio.c
ioengines.c
ioengines.h

index 3774df58442e086715e8e8c7c0a63bbf04a4b220..d5cb6ef56fa89e3636524bc3e13d74c1f0d24115 100644 (file)
--- 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
index d0b4a895afcb78c3619adebb15854236a324785c..37f9bbad501a113e0f4f4fc0c4ebcd22fca2bb5b 100644 (file)
@@ -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;
 
index caae1e09b5f8112d1725a5300b43ed4d1a9a56da..807d8505b21121999bb5f6b6626e7ab0aced1877 100644 (file)
@@ -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;
index 3619450d295d15c344616114c491cddddcfcb0f0..22d523125875a872180d70a7cbdc2b3d8eb948e9 100644 (file)
@@ -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;
index bb3ac85045b2f16fd650abe2c2081371acd6f2c1..a1f6a242b11bb60fe5742923105cfe394907145a 100644 (file)
@@ -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;
index 6fa041cdbaa1421b775b2ecfcf68a479c2d507f0..fb3f389791d9c61a4f14ce4b68953b608ee20648 100644 (file)
@@ -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;
 }
index 14e115f221b6434b65771905c24ad89d34cd7c55..4ff511ea7e2193eb3656eb841cb56c6ca3a4cc78 100644 (file)
@@ -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;
index 77844ffe4b724fa7420ea51f1b2c1b8d78c1caf6..eb5fdf504ea65ea4cab8ef546d29bde7c44b72d9 100644 (file)
@@ -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;
index eb8df453524d7d5de7dfbc3d84f53ae5d5fa57d7..9e1c4bf038f3b3ce2fbe27f3ddb19cffbd6f3dd2 100644 (file)
@@ -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;
index 5a145bd8633f2a6d3e041c9b2e9fce3fef871c47..a10e0ed68197fc592986063044322d9927f58577 100644 (file)
@@ -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;
index 9644ee59d4a4fdd39e1a82cebd2d3ede95fad414..4d33290850efd25dfb0792f613c03a4342219e2f 100644 (file)
@@ -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;
 
index 7d59df3869f12238d3ebdefc6ae4f85145b9de85..0e2263a743ad657244cc61a5a97ba0ba1b5d2e9a 100644 (file)
@@ -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;
 
index 96a0871d873ee8813876ce4ee47709de8b3c5b58..37694fafcb0269231c34d1fba6b2d26ca0855cdf 100644 (file)
@@ -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;
index dbb3f5c69c0f6546dbd7d08ed277aa06ab9e19aa..c3abe2a05542700bf7625671d314739bde285383 100644 (file)
@@ -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;
index 9dbefc8214dd71d7dc569864d7c571f7391fc5d7..856547befda3dea5e42ece3a123ed35c70663f66 100644 (file)
@@ -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);
index 5f822fc1f52009c9b60aa8cd9bd18fd3d9186f35..9e154836a5a61094c51e5c74634d128a9fdcaec5 100644 (file)
@@ -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);
index 4540e0e4d7c7eea9b9001f16cafb756225f3661a..8c25c4e5b12f254fbcd6d2eba1125f5d991f835a 100644 (file)
@@ -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;
index 8c26ad7179aa1589720e7d6e3d4e84e4261d3cc8..b1718e5c9a35fea7826fadcff340762e373c0e14 100644 (file)
@@ -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);
 }
index 264eb713cf7906ae7acb43737706e345b718a769..e2c558929ff22b883d7ae2d8abfbc787265e6695 100644 (file)
@@ -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);
index bddb1ec3f2697e43dff46dcc726ed31e419f27f0..4ac019578a7f8114a254ce425e8a4e76b74211cd 100644 (file)
@@ -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;
index dc0d7b1ef3b921eb1807318afb32a3d12da9d31f..f3795c5742ecfd3bd36ebe5f321ce1450d3d4cff 100644 (file)
@@ -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;
index 6582b06d287825a605780153ca3fa7bcd88af8a4..cf7337f00745198f21cd23379ea3362c8e6ee3cd 100644 (file)
@@ -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;
index 8def6eba0783ef4494b8b9f555974906d5ae450d..67c5aa7e23eb1f65b47ea5ad4b93886b630f2e82 100644 (file)
@@ -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;
 
index c2c0de39ef82903464f728f3e4ea489de993f538..56e5d18ab60ba90edb05b69c079fae70a2fdc104 100644 (file)
@@ -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;
index 56f89f957b5f502ccfe0add680ac80c6ef9d4a85..7e08afbb0fb34ed415d6a5548903c675baf97f70 100644 (file)
@@ -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
index 08fc857454ea2f82a38bf2dee3c6d91154bf1df4..18403608cbc61276de93e96116020e071ab096ba 100644 (file)
@@ -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;
index d5b4012f80338440068e242fa64f823ae02453cf..722320ef6de6b5dd5dc0eb3246d9c75746786174 100644 (file)
@@ -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;
 
index 94393931eeb38eb490ad76ab32305fd4b771a433..2b932f71460f196287e26b5f99d1509378ce3565 100644 (file)
@@ -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;
index 1d86848e4062afd7bd27bef7b61fb251d8f69d3c..6ffd27f10ec9e303b16a7e00ffefec000cab67d2 100644 (file)
@@ -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);
index 7d265e7471f35c2b1f30f7c79851713bb6bd5bba..feb21db893456ae4ba5948d47f620f13e3ba3c46 100644 (file)
@@ -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 *);