X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ioengines.c;h=e78b4f79acadc87a30808e54a7e78b55155318f6;hp=919781c4e8e11a78a62c0e4fa189fdc820a30902;hb=97bb54c9606c;hpb=d30455b5f301b9c8017a0c7439573835d7e177de diff --git a/ioengines.c b/ioengines.c index 919781c4..e78b4f79 100644 --- a/ioengines.c +++ b/ioengines.c @@ -123,13 +123,10 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td, return ops; } -struct ioengine_ops *load_ioengine(struct thread_data *td, const char *name) +static struct ioengine_ops *__load_ioengine(const char *name) { - struct ioengine_ops *ops; char engine[64]; - dprint(FD_IO, "load ioengine %s\n", name); - engine[sizeof(engine) - 1] = '\0'; strncpy(engine, name, sizeof(engine) - 1); @@ -139,9 +136,23 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, const char *name) if (!strncmp(engine, "linuxaio", 8) || !strncmp(engine, "aio", 3)) strcpy(engine, "libaio"); - ops = find_ioengine(engine); - if (!ops) + dprint(FD_IO, "load ioengine %s\n", engine); + return find_ioengine(engine); +} + +struct ioengine_ops *load_ioengine(struct thread_data *td) +{ + struct ioengine_ops *ops = NULL; + const char *name = NULL; + + if (strcmp(td->o.ioengine, "external")) { + name = td->o.ioengine; + ops = __load_ioengine(name); + } else if (td->o.ioengine_so_path) { + name = td->o.ioengine_so_path; ops = dlopen_ioengine(td, name); + } else + log_err("fio: missing external ioengine path\n"); if (!ops) { log_err("fio: engine %s not loadable\n", name); @@ -552,7 +563,6 @@ int td_io_get_file_size(struct thread_data *td, struct fio_file *f) int fio_show_ioengine_help(const char *engine) { struct flist_head *entry; - struct thread_data td; struct ioengine_ops *io_ops; char *sep; int ret = 1; @@ -571,9 +581,7 @@ int fio_show_ioengine_help(const char *engine) sep++; } - memset(&td, 0, sizeof(td)); - - io_ops = load_ioengine(&td, engine); + io_ops = __load_ioengine(engine); if (!io_ops) { log_info("IO engine %s not found\n", engine); return 1; @@ -584,7 +592,5 @@ int fio_show_ioengine_help(const char *engine) else log_info("IO engine %s has no options\n", io_ops->name); - free_ioengine(&td); - return ret; }