projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
engines/glusterfs_async: cleanups
[fio.git]
/
engines
/
glusterfs_async.c
diff --git
a/engines/glusterfs_async.c
b/engines/glusterfs_async.c
index f2b9818a66634026636170cef0145b81b4c5e991..d9d6693579fe88a71c36268e23cba854c95da716 100644
(file)
--- a/
engines/glusterfs_async.c
+++ b/
engines/glusterfs_async.c
@@
-10,11
+10,11
@@
struct fio_gf_iou {
struct io_u *io_u;
int io_complete;
};
struct io_u *io_u;
int io_complete;
};
-static ulong cb_count = 0, issued = 0;
static struct io_u *fio_gf_event(struct thread_data *td, int event)
{
struct gf_data *gf_data = td->io_ops->data;
static struct io_u *fio_gf_event(struct thread_data *td, int event)
{
struct gf_data *gf_data = td->io_ops->data;
+
dprint(FD_IO, "%s\n", __FUNCTION__);
return gf_data->aio_events[event];
}
dprint(FD_IO, "%s\n", __FUNCTION__);
return gf_data->aio_events[event];
}
@@
-25,18
+25,18
@@
static int fio_gf_getevents(struct thread_data *td, unsigned int min,
struct gf_data *g = td->io_ops->data;
unsigned int events = 0;
struct io_u *io_u;
struct gf_data *g = td->io_ops->data;
unsigned int events = 0;
struct io_u *io_u;
- int i = 0;
- struct fio_gf_iou *io = NULL;
+ int i;
dprint(FD_IO, "%s\n", __FUNCTION__);
do {
io_u_qiter(&td->io_u_all, io_u, i) {
dprint(FD_IO, "%s\n", __FUNCTION__);
do {
io_u_qiter(&td->io_u_all, io_u, i) {
+ struct fio_gf_iou *io;
+
if (!(io_u->flags & IO_U_F_FLIGHT))
continue;
if (!(io_u->flags & IO_U_F_FLIGHT))
continue;
- io = (struct fio_gf_iou *)io_u->engine_data;
-
- if (io && io->io_complete) {
+ io = io_u->engine_data;
+ if (io->io_complete) {
io->io_complete = 0;
g->aio_events[events] = io_u;
events++;
io->io_complete = 0;
g->aio_events[events] = io_u;
events++;
@@
-61,22
+61,20
@@
static void fio_gf_io_u_free(struct thread_data *td, struct io_u *io_u)
struct fio_gf_iou *io = io_u->engine_data;
if (io) {
struct fio_gf_iou *io = io_u->engine_data;
if (io) {
- if (io->io_complete)
{
+ if (io->io_complete)
log_err("incomplete IO found.\n");
log_err("incomplete IO found.\n");
- }
io_u->engine_data = NULL;
free(io);
}
io_u->engine_data = NULL;
free(io);
}
- log_err("issued %lu finished %lu\n", issued, cb_count);
}
static int fio_gf_io_u_init(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 = NULL;
-
dprint(FD_FILE, "%s\n", __FUNCTION__);
if (!io_u->engine_data) {
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");
io = malloc(sizeof(struct fio_gf_iou));
if (!io) {
td_verror(td, errno, "malloc");
@@
-91,53
+89,44
@@
static int fio_gf_io_u_init(struct thread_data *td, struct io_u *io_u)
static void gf_async_cb(glfs_fd_t * fd, ssize_t ret, void *data)
{
static void gf_async_cb(glfs_fd_t * fd, ssize_t ret, void *data)
{
- struct io_u *io_u =
(struct io_u *)
data;
- struct fio_gf_iou *iou =
(struct fio_gf_iou *)
io_u->engine_data;
+ struct io_u *io_u = data;
+ struct fio_gf_iou *iou = io_u->engine_data;
dprint(FD_IO, "%s ret %lu\n", __FUNCTION__, ret);
iou->io_complete = 1;
dprint(FD_IO, "%s ret %lu\n", __FUNCTION__, ret);
iou->io_complete = 1;
- cb_count++;
}
static int fio_gf_async_queue(struct thread_data fio_unused * td,
struct io_u *io_u)
{
struct gf_data *g = td->io_ops->data;
}
static int 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
= 0
;
+ int r;
- dprint(FD_IO, "%s op %s\n", __FUNCTION__,
- io_u->ddir == DDIR_READ ? "read" : io_u->ddir ==
- DDIR_WRITE ? "write" : io_u->ddir ==
- DDIR_SYNC ? "sync" : "unknown");
+ dprint(FD_IO, "%s op %s\n", __FUNCTION__, io_ddir_name(io_u->ddir));
fio_ro_check(td, io_u);
if (io_u->ddir == DDIR_READ)
r = glfs_pread_async(g->fd, io_u->xfer_buf, io_u->xfer_buflen,
fio_ro_check(td, io_u);
if (io_u->ddir == DDIR_READ)
r = glfs_pread_async(g->fd, io_u->xfer_buf, io_u->xfer_buflen,
- io_u->offset, 0, gf_async_cb,
- (void *)io_u);
+ io_u->offset, 0, gf_async_cb, io_u);
else if (io_u->ddir == DDIR_WRITE)
r = glfs_pwrite_async(g->fd, io_u->xfer_buf, io_u->xfer_buflen,
else if (io_u->ddir == DDIR_WRITE)
r = glfs_pwrite_async(g->fd, io_u->xfer_buf, io_u->xfer_buflen,
- io_u->offset, 0, gf_async_cb,
- (void *)io_u);
+ io_u->offset, 0, gf_async_cb, io_u);
#if defined(CONFIG_GF_TRIM)
else if (io_u->ddir == DDIR_TRIM)
r = glfs_discard_async(g->fd, io_u->offset, io_u->xfer_buflen,
gf_async_cb, io_u);
#endif
#if defined(CONFIG_GF_TRIM)
else if (io_u->ddir == DDIR_TRIM)
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_SYNC) {
- r = glfs_fsync_async(g->fd, gf_async_cb, (void *)io_u);
- } else {
- log_err("unsupported operation.\n");
- io_u->error = -EINVAL;
- goto failed;
- }
+ else if (io_u->ddir == DDIR_SYNC)
+ r = glfs_fsync_async(g->fd, gf_async_cb, io_u);
+ else
+ r = -EINVAL;
+
if (r) {
if (r) {
- log_err("glfs failed.\n");
+ log_err("glfs
queue
failed.\n");
io_u->error = r;
goto failed;
}
io_u->error = r;
goto failed;
}
- issued++;
return FIO_Q_QUEUED;
failed:
return FIO_Q_QUEUED;
failed:
@@
-148,29
+137,26
@@
failed:
int fio_gf_async_setup(struct thread_data *td)
{
int fio_gf_async_setup(struct thread_data *td)
{
-
int r = 0
;
-
struct gf_data *g = NULL
;
+
struct gf_data *g
;
+
int r
;
#if defined(NOT_YET)
log_err("the async interface is still very experimental...\n");
#endif
r = fio_gf_setup(td);
#if defined(NOT_YET)
log_err("the async interface is still very experimental...\n");
#endif
r = fio_gf_setup(td);
- if (r)
{
+ if (r)
return r;
return r;
- }
+
td->o.use_thread = 1;
g = td->io_ops->data;
td->o.use_thread = 1;
g = td->io_ops->data;
- g->aio_events =
malloc(td->o.iodepth *
sizeof(struct io_u *));
+ g->aio_events =
calloc(td->o.iodepth,
sizeof(struct io_u *));
if (!g->aio_events) {
r = -ENOMEM;
fio_gf_cleanup(td);
return r;
}
if (!g->aio_events) {
r = -ENOMEM;
fio_gf_cleanup(td);
return r;
}
- memset(g->aio_events, 0, td->o.iodepth * sizeof(struct io_u *));
-
return r;
return r;
-
}
static int fio_gf_async_prep(struct thread_data *td, struct io_u *io_u)
}
static int fio_gf_async_prep(struct thread_data *td, struct io_u *io_u)