ioengines: don't call zbd_put_io_u() for engines not implementing commit
[fio.git] / ioengines.c
index dcc9496dd4ddab6fe0c79612e13684e7b790441f..3561bb4e6ed0da7289e1079a2d0ffbc7e8f9aa1d 100644 (file)
@@ -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);
@@ -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);
 
        /*
@@ -229,6 +232,7 @@ void free_ioengine(struct thread_data *td)
        }
 
        if (td->io_ops->dlhandle) {
+               dprint(FD_IO, "dlclose ioengine %s\n", td->io_ops->name);
                dlclose(td->io_ops->dlhandle);
                td->io_ops->dlhandle = NULL;
        }
@@ -410,7 +414,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) {