X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Fglusterfs_async.c;h=0392ad6e3f1315c9f8214272ee2b98e2ebfa7455;hb=01fe773df4bc4a35450ce3ef50c8075b3bf55cd0;hp=d9d6693579fe88a71c36268e23cba854c95da716;hpb=8859391bb7d77680ede51b46e770237abae566dc;p=fio.git diff --git a/engines/glusterfs_async.c b/engines/glusterfs_async.c index d9d66935..0392ad6e 100644 --- a/engines/glusterfs_async.c +++ b/engines/glusterfs_async.c @@ -13,7 +13,7 @@ struct fio_gf_iou { static struct io_u *fio_gf_event(struct thread_data *td, int event) { - struct gf_data *gf_data = td->io_ops->data; + struct gf_data *gf_data = td->io_ops_data; dprint(FD_IO, "%s\n", __FUNCTION__); return gf_data->aio_events[event]; @@ -22,7 +22,7 @@ static struct io_u *fio_gf_event(struct thread_data *td, int event) static int fio_gf_getevents(struct thread_data *td, unsigned int min, unsigned int max, const struct timespec *t) { - struct gf_data *g = td->io_ops->data; + struct gf_data *g = td->io_ops_data; unsigned int events = 0; struct io_u *io_u; int i; @@ -70,36 +70,38 @@ static void fio_gf_io_u_free(struct thread_data *td, struct io_u *io_u) static int fio_gf_io_u_init(struct thread_data *td, struct io_u *io_u) { + struct fio_gf_iou *io; dprint(FD_FILE, "%s\n", __FUNCTION__); - - if (!io_u->engine_data) { - struct fio_gf_iou *io; - - io = malloc(sizeof(struct fio_gf_iou)); - if (!io) { - td_verror(td, errno, "malloc"); - return 1; - } - io->io_complete = 0; - io->io_u = io_u; - io_u->engine_data = io; - } + + io = malloc(sizeof(struct fio_gf_iou)); + if (!io) { + td_verror(td, errno, "malloc"); + return 1; + } + io->io_complete = 0; + io->io_u = io_u; + io_u->engine_data = io; return 0; } +#if defined(CONFIG_GF_NEW_API) +static void gf_async_cb(glfs_fd_t * fd, ssize_t ret, struct glfs_stat *prestat, + struct glfs_stat *poststat, void *data) +#else static void gf_async_cb(glfs_fd_t * fd, ssize_t ret, void *data) +#endif { struct io_u *io_u = data; struct fio_gf_iou *iou = io_u->engine_data; - dprint(FD_IO, "%s ret %lu\n", __FUNCTION__, ret); + dprint(FD_IO, "%s ret %zd\n", __FUNCTION__, ret); 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; + struct gf_data *g = td->io_ops_data; int r; dprint(FD_IO, "%s op %s\n", __FUNCTION__, io_ddir_name(io_u->ddir)); @@ -117,10 +119,12 @@ static int fio_gf_async_queue(struct thread_data fio_unused * td, r = glfs_discard_async(g->fd, io_u->offset, io_u->xfer_buflen, gf_async_cb, io_u); #endif + else if (io_u->ddir == DDIR_DATASYNC) + r = glfs_fdatasync_async(g->fd, gf_async_cb, io_u); else if (io_u->ddir == DDIR_SYNC) r = glfs_fsync_async(g->fd, gf_async_cb, io_u); else - r = -EINVAL; + r = EINVAL; if (r) { log_err("glfs queue failed.\n"); @@ -135,7 +139,7 @@ failed: return FIO_Q_COMPLETED; } -int fio_gf_async_setup(struct thread_data *td) +static int fio_gf_async_setup(struct thread_data *td) { struct gf_data *g; int r; @@ -148,7 +152,7 @@ int fio_gf_async_setup(struct thread_data *td) return r; td->o.use_thread = 1; - g = td->io_ops->data; + g = td->io_ops_data; g->aio_events = calloc(td->o.iodepth, sizeof(struct io_u *)); if (!g->aio_events) { r = -ENOMEM; @@ -159,22 +163,11 @@ int fio_gf_async_setup(struct thread_data *td) return r; } -static int fio_gf_async_prep(struct thread_data *td, struct io_u *io_u) -{ - dprint(FD_FILE, "%s\n", __FUNCTION__); - - if (!ddir_rw(io_u->ddir)) - return 0; - - return 0; -} - static struct ioengine_ops ioengine = { .name = "gfapi_async", .version = FIO_IOOPS_VERSION, .init = fio_gf_async_setup, .cleanup = fio_gf_cleanup, - .prep = fio_gf_async_prep, .queue = fio_gf_async_queue, .open_file = fio_gf_open_file, .close_file = fio_gf_close_file,