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);
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);
}
#endif
-#ifdef FIO_OS_DIRECTIO
- /*
- * Some OS's have a distinct call to mark the file non-buffered,
- * instead of using O_DIRECT (Solaris)
- */
- if (td->o.odirect) {
- int ret = fio_set_odirect(f->fd);
-
- if (ret) {
- td_verror(td, ret, "fio_set_odirect");
-#if defined(__sun__)
- if (ret == ENOTTY) { /* ENOTTY suggests RAW device or ZFS */
- log_err("fio: doing directIO to RAW devices or ZFS not supported\n");
- } else {
- log_err("fio: the file system does not seem to support direct IO\n");
- }
-#else
- log_err("fio: the file system does not seem to support direct IO\n");
-#endif
- goto err;
- }
- }
-#endif
+ if (td->o.odirect && !OS_O_DIRECT && fio_set_directio(td, f))
+ goto err;
done:
log_file(td, f, FIO_LOG_OPEN_FILE);
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;
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;
else
log_info("IO engine %s has no options\n", io_ops->name);
- free_ioengine(&td);
-
return ret;
}