X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ioengines.c;h=d08a511a0635eccc090528dfa2ff242fd5719209;hp=5ac512ae05c6c07c1a4daacc126b7bc56ddb9280;hb=ed7f3a07363d62c6d6147b0c568f87f079d241a8;hpb=8bdf7a84888a329839932cf833a7633ecd36f252 diff --git a/ioengines.c b/ioengines.c index 5ac512ae..d08a511a 100644 --- a/ioengines.c +++ b/ioengines.c @@ -95,6 +95,7 @@ static void *dlopen_external(struct thread_data *td, const char *engine) sprintf(engine_path, "%s/fio-%s.so", FIO_EXT_ENG_DIR, engine); + dprint(FD_IO, "dlopen external %s\n", engine_path); dlhandle = dlopen(engine_path, RTLD_LAZY); if (!dlhandle) log_info("Engine %s not found; Either name is invalid, was not built, or fio-engine-%s package is missing.\n", @@ -116,7 +117,7 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td, !strncmp(engine_lib, "aio", 3)) engine_lib = "libaio"; - dprint(FD_IO, "dload engine %s\n", engine_lib); + dprint(FD_IO, "dlopen engine %s\n", engine_lib); dlerror(); dlhandle = dlopen(engine_lib, RTLD_LAZY); @@ -155,7 +156,7 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td, return NULL; } - td->io_ops_dlhandle = dlhandle; + ops->dlhandle = dlhandle; return ops; } @@ -194,7 +195,9 @@ struct ioengine_ops *load_ioengine(struct thread_data *td) * so as not to break job files not using the prefix. */ ops = __load_ioengine(td->o.ioengine); - if (!ops) + + /* We do re-dlopen existing handles, for reference counting */ + if (!ops || ops->dlhandle) ops = dlopen_ioengine(td, name); /* @@ -228,9 +231,9 @@ void free_ioengine(struct thread_data *td) td->eo = NULL; } - if (td->io_ops_dlhandle) { - dlclose(td->io_ops_dlhandle); - td->io_ops_dlhandle = NULL; + if (td->io_ops->dlhandle) { + dprint(FD_IO, "dlclose ioengine %s\n", td->io_ops->name); + dlclose(td->io_ops->dlhandle); } td->io_ops = NULL; @@ -410,7 +413,6 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u) if (!td->io_ops->commit) { io_u_mark_submit(td, 1); io_u_mark_complete(td, 1); - zbd_put_io_u(td, io_u); } if (ret == FIO_Q_COMPLETED) { @@ -690,17 +692,17 @@ int fio_show_ioengine_help(const char *engine) } td.o.ioengine = (char *)engine; - io_ops = load_ioengine(&td); + td.io_ops = load_ioengine(&td); - if (!io_ops) { + if (!td.io_ops) { log_info("IO engine %s not found\n", engine); return 1; } - if (io_ops->options) - ret = show_cmd_help(io_ops->options, sep); + if (td.io_ops->options) + ret = show_cmd_help(td.io_ops->options, sep); else - log_info("IO engine %s has no options\n", io_ops->name); + log_info("IO engine %s has no options\n", td.io_ops->name); free_ioengine(&td); return ret;