fio: Perform bdev initialization inside a thread message
This ensures that these calls are executed on an SPDK thread. Change-Id: I8cb4ee48c2f8bf4604e478e71e97bda856b6f0d0 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/436551 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
d722a1742d
commit
c4f0818bd3
@ -88,12 +88,6 @@ static size_t spdk_fio_poll_thread(struct spdk_fio_thread *fio_thread);
|
||||
/* Default polling timeout (us) */
|
||||
#define SPDK_FIO_POLLING_TIMEOUT 1000000UL
|
||||
|
||||
static void
|
||||
spdk_fio_bdev_init_done(void *cb_arg, int rc)
|
||||
{
|
||||
*(bool *)cb_arg = true;
|
||||
}
|
||||
|
||||
static int
|
||||
spdk_fio_init_thread(struct thread_data *td)
|
||||
{
|
||||
@ -166,6 +160,24 @@ static pthread_mutex_t g_init_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_cond_t g_init_cond;
|
||||
static bool g_poll_loop = true;
|
||||
|
||||
static void
|
||||
spdk_fio_bdev_init_done(void *cb_arg, int rc)
|
||||
{
|
||||
*(bool *)cb_arg = true;
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_fio_bdev_init_start(void *arg)
|
||||
{
|
||||
bool *done = arg;
|
||||
|
||||
/* Initialize the copy engine */
|
||||
spdk_copy_engine_initialize();
|
||||
|
||||
/* Initialize the bdev layer */
|
||||
spdk_bdev_initialize(spdk_fio_bdev_init_done, done);
|
||||
}
|
||||
|
||||
static void *
|
||||
spdk_init_thread_poll(void *arg)
|
||||
{
|
||||
@ -240,14 +252,10 @@ spdk_init_thread_poll(void *arg)
|
||||
|
||||
fio_thread = td.io_ops_data;
|
||||
|
||||
/* Initialize the copy engine */
|
||||
spdk_copy_engine_initialize();
|
||||
|
||||
/* Initialize the bdev layer */
|
||||
done = false;
|
||||
spdk_bdev_initialize(spdk_fio_bdev_init_done, &done);
|
||||
spdk_thread_send_msg(fio_thread->thread, spdk_fio_bdev_init_start, &done);
|
||||
|
||||
/* First, poll until initialization is done. */
|
||||
do {
|
||||
spdk_fio_poll_thread(fio_thread);
|
||||
} while (!done);
|
||||
|
Loading…
Reference in New Issue
Block a user