Commit 068b6fb3 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

bdev/fio_plugin: flush any remaining events after done



In some cases, an io_channel will be put (freed) as part
of the last execution of a poller.  Previously, the
callback would set done=1 and would not continue
executing events meaning the deferred put_io_channel
events would not get executed.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ia5a6ea6873ceb1c3d5daf0545cdc3615d11712d2

Reviewed-on: https://review.gerrithub.io/402139


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent a562812d
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -273,10 +273,18 @@ spdk_fio_init_env(struct thread_data *td)
	/* Initialize the bdev layer */
	spdk_bdev_initialize(spdk_fio_bdev_init_done, &done);

	/* First, poll until initialization is done. */
	do {
		spdk_fio_poll_thread(fio_thread);
	} while (!done);

	/*
	 * Continue polling until there are no more events.
	 * This handles any final events posted by pollers.
	 */
	do {
		/* Handle init and all cleanup events */
		count = spdk_fio_poll_thread(fio_thread);
	} while (!done || count > 0);
	} while (count > 0);

	return 0;
}
@@ -677,16 +685,24 @@ spdk_fio_finish_env(void)

	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 (!done || count > 0);
	} while (count > 0);

	done = false;
	spdk_copy_engine_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 (!done || count > 0);
	} while (count > 0);

	spdk_fio_cleanup_thread(fio_thread);
}