|
Eric Sandeen |
c47191 |
From f6931a1dd35896433c8cc2e10de51372a2c496c4 Mon Sep 17 00:00:00 2001
|
|
Eric Sandeen |
c47191 |
From: Eric Sandeen <sandeen@redhat.com>
|
|
Eric Sandeen |
c47191 |
Date: Mon, 25 Jan 2021 13:18:31 -0600
|
|
Eric Sandeen |
c47191 |
Subject: [PATCH] fio: move dynamic library handle to io_ops structure
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
Keeping a dynamic engine's dlopen'd dlhandle on a thread structure doesn't
|
|
Eric Sandeen |
c47191 |
make sense; that thread may exit while others are still using the engine.
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
Move the dlhandle onto the ops structure itself.
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
We still only call dlopen for the first thead, which leaves a refcounting
|
|
Eric Sandeen |
c47191 |
issue which will be fixed in the next patch.
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
Eric Sandeen |
c47191 |
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Eric Sandeen |
c47191 |
---
|
|
Eric Sandeen |
c47191 |
fio.h | 1 -
|
|
Eric Sandeen |
c47191 |
init.c | 6 +++---
|
|
Eric Sandeen |
c47191 |
ioengines.c | 8 ++++----
|
|
Eric Sandeen |
c47191 |
ioengines.h | 3 ++-
|
|
Eric Sandeen |
c47191 |
4 files changed, 9 insertions(+), 9 deletions(-)
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
diff --git a/fio.h b/fio.h
|
|
Eric Sandeen |
c47191 |
index ee582a72..062abfa7 100644
|
|
Eric Sandeen |
c47191 |
--- a/fio.h
|
|
Eric Sandeen |
c47191 |
+++ b/fio.h
|
|
Eric Sandeen |
c47191 |
@@ -281,7 +281,6 @@ struct thread_data {
|
|
Eric Sandeen |
c47191 |
* IO engine private data and dlhandle.
|
|
Eric Sandeen |
c47191 |
*/
|
|
Eric Sandeen |
c47191 |
void *io_ops_data;
|
|
Eric Sandeen |
c47191 |
- void *io_ops_dlhandle;
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
/*
|
|
Eric Sandeen |
c47191 |
* Queue depth of io_u's that fio MIGHT do
|
|
Eric Sandeen |
c47191 |
diff --git a/init.c b/init.c
|
|
Eric Sandeen |
c47191 |
index 1d14df16..ab38b334 100644
|
|
Eric Sandeen |
c47191 |
--- a/init.c
|
|
Eric Sandeen |
c47191 |
+++ b/init.c
|
|
Eric Sandeen |
c47191 |
@@ -1104,18 +1104,18 @@ int ioengine_load(struct thread_data *td)
|
|
Eric Sandeen |
c47191 |
* for this name and see if they match. If they do, then
|
|
Eric Sandeen |
c47191 |
* the engine is unchanged.
|
|
Eric Sandeen |
c47191 |
*/
|
|
Eric Sandeen |
c47191 |
- dlhandle = td->io_ops_dlhandle;
|
|
Eric Sandeen |
c47191 |
+ dlhandle = td->io_ops->dlhandle;
|
|
Eric Sandeen |
c47191 |
ops = load_ioengine(td);
|
|
Eric Sandeen |
c47191 |
if (!ops)
|
|
Eric Sandeen |
c47191 |
goto fail;
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
- if (ops == td->io_ops && dlhandle == td->io_ops_dlhandle) {
|
|
Eric Sandeen |
c47191 |
+ if (ops == td->io_ops && dlhandle == td->io_ops->dlhandle) {
|
|
Eric Sandeen |
c47191 |
if (dlhandle)
|
|
Eric Sandeen |
c47191 |
dlclose(dlhandle);
|
|
Eric Sandeen |
c47191 |
return 0;
|
|
Eric Sandeen |
c47191 |
}
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
- if (dlhandle && dlhandle != td->io_ops_dlhandle)
|
|
Eric Sandeen |
c47191 |
+ if (dlhandle && dlhandle != td->io_ops->dlhandle)
|
|
Eric Sandeen |
c47191 |
dlclose(dlhandle);
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
/* Unload the old engine. */
|
|
Eric Sandeen |
c47191 |
diff --git a/ioengines.c b/ioengines.c
|
|
Eric Sandeen |
c47191 |
index 5ac512ae..dcc9496d 100644
|
|
Eric Sandeen |
c47191 |
--- a/ioengines.c
|
|
Eric Sandeen |
c47191 |
+++ b/ioengines.c
|
|
Eric Sandeen |
c47191 |
@@ -155,7 +155,7 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td,
|
|
Eric Sandeen |
c47191 |
return NULL;
|
|
Eric Sandeen |
c47191 |
}
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
- td->io_ops_dlhandle = dlhandle;
|
|
Eric Sandeen |
c47191 |
+ ops->dlhandle = dlhandle;
|
|
Eric Sandeen |
c47191 |
return ops;
|
|
Eric Sandeen |
c47191 |
}
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
@@ -228,9 +228,9 @@ void free_ioengine(struct thread_data *td)
|
|
Eric Sandeen |
c47191 |
td->eo = NULL;
|
|
Eric Sandeen |
c47191 |
}
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
- if (td->io_ops_dlhandle) {
|
|
Eric Sandeen |
c47191 |
- dlclose(td->io_ops_dlhandle);
|
|
Eric Sandeen |
c47191 |
- td->io_ops_dlhandle = NULL;
|
|
Eric Sandeen |
c47191 |
+ if (td->io_ops->dlhandle) {
|
|
Eric Sandeen |
c47191 |
+ dlclose(td->io_ops->dlhandle);
|
|
Eric Sandeen |
c47191 |
+ td->io_ops->dlhandle = NULL;
|
|
Eric Sandeen |
c47191 |
}
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
td->io_ops = NULL;
|
|
Eric Sandeen |
c47191 |
diff --git a/ioengines.h b/ioengines.h
|
|
Eric Sandeen |
c47191 |
index a928b211..839b318d 100644
|
|
Eric Sandeen |
c47191 |
--- a/ioengines.h
|
|
Eric Sandeen |
c47191 |
+++ b/ioengines.h
|
|
Eric Sandeen |
c47191 |
@@ -8,7 +8,7 @@
|
|
Eric Sandeen |
c47191 |
#include "io_u.h"
|
|
Eric Sandeen |
c47191 |
#include "zbd_types.h"
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
-#define FIO_IOOPS_VERSION 27
|
|
Eric Sandeen |
c47191 |
+#define FIO_IOOPS_VERSION 28
|
|
Eric Sandeen |
c47191 |
|
|
Eric Sandeen |
c47191 |
#ifndef CONFIG_DYNAMIC_ENGINES
|
|
Eric Sandeen |
c47191 |
#define FIO_STATIC static
|
|
Eric Sandeen |
c47191 |
@@ -30,6 +30,7 @@ struct ioengine_ops {
|
|
Eric Sandeen |
c47191 |
const char *name;
|
|
Eric Sandeen |
c47191 |
int version;
|
|
Eric Sandeen |
c47191 |
int flags;
|
|
Eric Sandeen |
c47191 |
+ void *dlhandle;
|
|
Eric Sandeen |
c47191 |
int (*setup)(struct thread_data *);
|
|
Eric Sandeen |
c47191 |
int (*init)(struct thread_data *);
|
|
Eric Sandeen |
c47191 |
int (*post_init)(struct thread_data *);
|
|
Eric Sandeen |
c47191 |
--
|
|
Eric Sandeen |
c47191 |
2.26.2
|
|
Eric Sandeen |
c47191 |
|