* [PATCH, RFC] list all available dynamic ioengines with --enghelp
@ 2020-11-06 22:07 Eric Sandeen
2020-11-07 18:15 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2020-11-06 22:07 UTC (permalink / raw)
To: fio
When dynamic engines are enabled, "fio --enghelp" does not list all
available engines as the man page says it will:
If no ioengine is given, list all available ioengines.
Fix this by opening FIO_EXT_ENG_DIR and attempting dlopen_ioengine
everything that's found there.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
(not sure if I'm DTRT with thread_data here ...)
diff --git a/ioengines.c b/ioengines.c
index fb59349a..c688dd1d 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -15,6 +15,8 @@
#include <dlfcn.h>
#include <fcntl.h>
#include <assert.h>
+#include <sys/types.h>
+#include <dirent.h>
#include "fio.h"
#include "diskutil.h"
@@ -630,6 +632,34 @@ int td_io_get_file_size(struct thread_data *td, struct fio_file *f)
return td->io_ops->get_file_size(td, f);
}
+#ifdef CONFIG_DYNAMIC_ENGINES
+/* Load all dynamic engines in FIO_EXT_ENG_DIR for enghelp command */
+static void
+fio_load_dynamic_engines(struct thread_data *td)
+{
+ DIR *dirhandle = NULL;
+ struct dirent *dirent = NULL;
+ char engine_path[PATH_MAX];
+
+ dirhandle = opendir(FIO_EXT_ENG_DIR);
+ if (!dirhandle)
+ return;
+
+ while ((dirent = readdir(dirhandle)) != NULL) {
+ if (!strcmp(dirent->d_name, ".") ||
+ !strcmp(dirent->d_name, ".."))
+ continue;
+
+ sprintf(engine_path, "%s/%s", FIO_EXT_ENG_DIR, dirent->d_name);
+ dlopen_ioengine(td, engine_path);
+ }
+
+ closedir(dirhandle);
+}
+#else
+#define fio_load_dynamic_engines(td) do { } while (0)
+#endif
+
int fio_show_ioengine_help(const char *engine)
{
struct flist_head *entry;
@@ -638,8 +668,11 @@ int fio_show_ioengine_help(const char *engine)
char *sep;
int ret = 1;
+ memset(&td, 0, sizeof(struct thread_data));
+
if (!engine || !*engine) {
log_info("Available IO engines:\n");
+ fio_load_dynamic_engines(&td);
flist_for_each(entry, &engine_list) {
io_ops = flist_entry(entry, struct ioengine_ops, list);
log_info("\t%s\n", io_ops->name);
@@ -652,7 +685,6 @@ int fio_show_ioengine_help(const char *engine)
sep++;
}
- memset(&td, 0, sizeof(struct thread_data));
td.o.ioengine = (char *)engine;
io_ops = load_ioengine(&td);
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH, RFC] list all available dynamic ioengines with --enghelp
2020-11-06 22:07 [PATCH, RFC] list all available dynamic ioengines with --enghelp Eric Sandeen
@ 2020-11-07 18:15 ` Eric Sandeen
2020-11-09 14:36 ` Richard W.M. Jones
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2020-11-07 18:15 UTC (permalink / raw)
To: fio
On 11/6/20 4:07 PM, Eric Sandeen wrote:
> When dynamic engines are enabled, "fio --enghelp" does not list all
> available engines as the man page says it will:
>
> If no ioengine is given, list all available ioengines.
>
> Fix this by opening FIO_EXT_ENG_DIR and attempting dlopen_ioengine
> everything that's found there.
The last(?) thing that would be nice to fix for the dynamic engines is to
not hardcode FIO_EXT_ENG_DIR to /usr/lib/fio since many systems will
be using /usr/lib64, but I'm not really sure how to do that best in
the hardcoded configure world of fio ... I could hack something up.
-Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH, RFC] list all available dynamic ioengines with --enghelp
2020-11-07 18:15 ` Eric Sandeen
@ 2020-11-09 14:36 ` Richard W.M. Jones
0 siblings, 0 replies; 3+ messages in thread
From: Richard W.M. Jones @ 2020-11-09 14:36 UTC (permalink / raw)
To: Eric Sandeen; +Cc: fio
On Sat, Nov 07, 2020 at 12:15:18PM -0600, Eric Sandeen wrote:
> On 11/6/20 4:07 PM, Eric Sandeen wrote:
> > When dynamic engines are enabled, "fio --enghelp" does not list all
> > available engines as the man page says it will:
> >
> > If no ioengine is given, list all available ioengines.
> >
> > Fix this by opening FIO_EXT_ENG_DIR and attempting dlopen_ioengine
> > everything that's found there.
>
> The last(?) thing that would be nice to fix for the dynamic engines is to
> not hardcode FIO_EXT_ENG_DIR to /usr/lib/fio since many systems will
> be using /usr/lib64, but I'm not really sure how to do that best in
> the hardcoded configure world of fio ... I could hack something up.
Not to mention FreeBSD which seems to be using /usr/local/lib, or
would do if they had enabled the modules
(https://www.freshports.org/benchmarks/fio/).
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-09 14:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-06 22:07 [PATCH, RFC] list all available dynamic ioengines with --enghelp Eric Sandeen
2020-11-07 18:15 ` Eric Sandeen
2020-11-09 14:36 ` Richard W.M. Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox