Commit a4a497d5 authored by paul luse's avatar paul luse Committed by Daniel Verkamp
Browse files

bdev: add new optional bdev i/f entry point



Add new optional bdev module interface function, init_complete, to notify bdev modules
when the bdev subsystem initialization is complete. Useful for virtual bdevs that require
notification that the set of initialization examine() calls is complete.

Change-Id: I0997fb5749d430f2fd3a40172ec8a1d5caa96964
Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/407222


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent bdfeddd3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,12 @@

## v18.04: (Upcoming Release)

### Bdev

Add new optional bdev module interface function, init_complete, to notify bdev modules
when the bdev subsystem initialization is complete. Useful for virtual bdevs that require
notification that the set of initialization examine() calls is complete.

### RPC

The Rpc configuration file section, which was deprecated in v18.01, has been removed.
+8 −0
Original line number Diff line number Diff line
@@ -86,6 +86,14 @@ struct spdk_bdev_module {
	 */
	int (*module_init)(void);

	/**
	 * Optional callback for modules that require notification of when
	 * the bdev subsystem has completed initialization.
	 *
	 * Modules are not required to define this function.
	 */
	void (*init_complete)(void);

	/**
	 * Finish function for the module.  Called by the spdk application
	 * before the spdk application exits to perform any necessary cleanup.
+10 −0
Original line number Diff line number Diff line
@@ -517,6 +517,16 @@ spdk_bdev_module_action_complete(void)
		}
	}

	/*
	 * For modules that need to know when subsystem init is complete,
	 * inform them now.
	 */
	TAILQ_FOREACH(m, &g_bdev_mgr.bdev_modules, tailq) {
		if (m->init_complete) {
			m->init_complete();
		}
	}

	/*
	 * Modules already finished initialization - now that all
	 * the bdev modules have finished their asynchronous I/O
+10 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ struct spdk_bdev_desc *g_desc;
bool g_teardown_done = false;
bool g_get_io_channel = true;
bool g_create_ch = true;
bool g_init_complete_called = false;

static int
stub_create_ch(void *io_device, void *ctx_buf)
@@ -191,10 +192,17 @@ module_fini(void)
{
}

static void
init_complete(void)
{
	g_init_complete_called = true;
}

struct spdk_bdev_module bdev_ut_if = {
	.name = "bdev_ut",
	.module_init = module_init,
	.module_fini = module_fini,
	.init_complete = init_complete,
};

SPDK_BDEV_MODULE_REGISTER(&bdev_ut_if)
@@ -281,7 +289,9 @@ bdev_io_tailq_cnt(bdev_io_tailq_t *tailq)
static void
basic(void)
{
	g_init_complete_called = false;
	setup_test();
	CU_ASSERT(g_init_complete_called == true);

	set_thread(0);