X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ioengines.c;h=879c5f1c1f438a20a5116bec93968fc0d4e0642f;hp=d34d2f4303764566da297e327670d935e23de7ea;hb=f85ac25a7d5c9d5ba4d5c73363a6a2a461a9b013;hpb=9de6bebc4cb18e0652a698c86f359fc730f322ad diff --git a/ioengines.c b/ioengines.c index d34d2f43..879c5f1c 100644 --- a/ioengines.c +++ b/ioengines.c @@ -56,12 +56,14 @@ static int check_engine_ops(struct ioengine_ops *ops) void unregister_ioengine(struct ioengine_ops *ops) { + dprint(FD_IO, "ioengine %s unregistered\n", ops->name); list_del(&ops->list); INIT_LIST_HEAD(&ops->list); } void register_ioengine(struct ioengine_ops *ops) { + dprint(FD_IO, "ioengine %s registered\n", ops->name); INIT_LIST_HEAD(&ops->list); list_add_tail(&ops->list, &engine_list); } @@ -86,6 +88,8 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td, struct ioengine_ops *ops; void *dlhandle; + dprint(FD_IO, "dload engine %s\n", engine_lib); + dlerror(); dlhandle = dlopen(engine_lib, RTLD_LAZY); if (!dlhandle) { @@ -113,6 +117,8 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, const char *name) struct ioengine_ops *ops, *ret; char engine[16]; + dprint(FD_IO, "load ioengine %s\n", name); + strncpy(engine, name, sizeof(engine) - 1); /* @@ -145,6 +151,8 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, const char *name) void close_ioengine(struct thread_data *td) { + dprint(FD_IO, "close ioengine %s\n", td->io_ops->name); + if (td->io_ops->cleanup) td->io_ops->cleanup(td); @@ -157,33 +165,43 @@ void close_ioengine(struct thread_data *td) int td_io_prep(struct thread_data *td, struct io_u *io_u) { + dprint_io_u(io_u, "prep"); fio_ro_check(td, io_u); - if (td->io_ops->prep) - return td->io_ops->prep(td, io_u); + if (td->io_ops->prep) { + int ret = td->io_ops->prep(td, io_u); + + dprint(FD_IO, "->prep(%p)=%d\n", io_u, ret); + return ret; + } return 0; } -int td_io_getevents(struct thread_data *td, int min, int max, +int td_io_getevents(struct thread_data *td, unsigned int min, unsigned int max, struct timespec *t) { - if (min > 0 && td->io_ops->commit) { - int r = td->io_ops->commit(td); + int r = 0; + if (min > 0 && td->io_ops->commit) { + r = td->io_ops->commit(td); if (r < 0) - return r; + goto out; } - if (td->io_ops->getevents) - return td->io_ops->getevents(td, min, max, t); - return 0; + r = 0; + if (td->io_ops->getevents) + r = td->io_ops->getevents(td, min, max, t); +out: + dprint(FD_IO, "getevents: %d\n", r); + return r; } int td_io_queue(struct thread_data *td, struct io_u *io_u) { int ret; + dprint_io_u(io_u, "queue"); fio_ro_check(td, io_u); assert((io_u->flags & IO_U_F_FLIGHT) == 0); @@ -208,10 +226,11 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u) if (io_u->ddir != DDIR_SYNC) td->io_issues[io_u->ddir]++; - io_u_mark_depth(td, io_u); - ret = td->io_ops->queue(td, io_u); + if (ret != FIO_Q_BUSY) + io_u_mark_depth(td, io_u); + if (ret == FIO_Q_QUEUED) { int r; @@ -253,6 +272,8 @@ int td_io_init(struct thread_data *td) int td_io_commit(struct thread_data *td) { + dprint(FD_IO, "calling ->commit(), depth %d\n", td->cur_depth); + if (!td->cur_depth) return 0; @@ -282,7 +303,6 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f) } f->last_free_lookup = 0; - f->last_completed_pos = 0; f->last_pos = f->file_offset; f->flags |= FIO_FILE_OPEN; f->flags &= ~FIO_FILE_CLOSING; @@ -323,7 +343,7 @@ err: return 1; } -void td_io_close_file(struct thread_data *td, struct fio_file *f) +int td_io_close_file(struct thread_data *td, struct fio_file *f) { if (!(f->flags & FIO_FILE_CLOSING)) log_file(td, f, FIO_LOG_CLOSE_FILE); @@ -333,5 +353,5 @@ void td_io_close_file(struct thread_data *td, struct fio_file *f) */ f->flags |= FIO_FILE_CLOSING; - put_file(td, f); + return put_file(td, f); }