Commit b9cdb813 authored by Ben Walker's avatar Ben Walker
Browse files

fio: Do bdev shutdown in a thread message



This ensures that it occurs on an SPDK thread

Change-Id: I62d15d6b0fd4fe56939c664e44eecd3199014292
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/436552


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent c4f0818b
Loading
Loading
Loading
Loading
+25 −22
Original line number Diff line number Diff line
@@ -139,12 +139,6 @@ spdk_fio_cleanup_thread(struct spdk_fio_thread *fio_thread)
	free(fio_thread);
}

static void
spdk_fio_module_finish_done(void *cb_arg)
{
	*(bool *)cb_arg = true;
}

static void
spdk_fio_calc_timeout(struct timespec *ts, uint64_t us)
{
@@ -178,6 +172,28 @@ spdk_fio_bdev_init_start(void *arg)
	spdk_bdev_initialize(spdk_fio_bdev_init_done, done);
}

static void
spdk_fio_bdev_fini_done(void *cb_arg)
{
	*(bool *)cb_arg = true;
}

static void
spdk_fio_copy_fini_start(void *arg)
{
	bool *done = arg;

	spdk_copy_engine_finish(spdk_fio_bdev_fini_done, done);
}

static void
spdk_fio_bdev_fini_start(void *arg)
{
	bool *done = arg;

	spdk_bdev_finish(spdk_fio_copy_fini_start, done);
}

static void *
spdk_init_thread_poll(void *arg)
{
@@ -187,7 +203,6 @@ spdk_init_thread_poll(void *arg)
	struct spdk_env_opts		opts;
	bool				done;
	int				rc;
	size_t				count;
	struct timespec			ts;
	struct thread_data		td = {};

@@ -284,27 +299,15 @@ spdk_init_thread_poll(void *arg)

	pthread_mutex_unlock(&g_init_mtx);

	/* Finalize the bdev layer */
	done = false;
	spdk_bdev_finish(spdk_fio_module_finish_done, &done);

	do {
		spdk_fio_poll_thread(fio_thread);
	} while (!done);

	do {
		count = spdk_fio_poll_thread(fio_thread);
	} while (count > 0);

	done = false;
	spdk_copy_engine_finish(spdk_fio_module_finish_done, &done);
	spdk_thread_send_msg(fio_thread->thread, spdk_fio_bdev_fini_start, &done);

	do {
		spdk_fio_poll_thread(fio_thread);
	} while (!done);

	do {
		count = spdk_fio_poll_thread(fio_thread);
	} while (count > 0);
	while (spdk_fio_poll_thread(fio_thread) > 0) {};

	spdk_fio_cleanup_thread(fio_thread);