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: paul luse <paul.e.luse@intel.com> Reviewed-on: https://review.gerrithub.io/407222 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
bdfeddd3a3
commit
a4a497d5b0
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
## v18.04: (Upcoming Release)
|
## 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
|
### RPC
|
||||||
|
|
||||||
The Rpc configuration file section, which was deprecated in v18.01, has been removed.
|
The Rpc configuration file section, which was deprecated in v18.01, has been removed.
|
||||||
|
@ -86,6 +86,14 @@ struct spdk_bdev_module {
|
|||||||
*/
|
*/
|
||||||
int (*module_init)(void);
|
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
|
* Finish function for the module. Called by the spdk application
|
||||||
* before the spdk application exits to perform any necessary cleanup.
|
* before the spdk application exits to perform any necessary cleanup.
|
||||||
|
@ -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
|
* Modules already finished initialization - now that all
|
||||||
* the bdev modules have finished their asynchronous I/O
|
* the bdev modules have finished their asynchronous I/O
|
||||||
|
@ -78,6 +78,7 @@ struct spdk_bdev_desc *g_desc;
|
|||||||
bool g_teardown_done = false;
|
bool g_teardown_done = false;
|
||||||
bool g_get_io_channel = true;
|
bool g_get_io_channel = true;
|
||||||
bool g_create_ch = true;
|
bool g_create_ch = true;
|
||||||
|
bool g_init_complete_called = false;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
stub_create_ch(void *io_device, void *ctx_buf)
|
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 = {
|
struct spdk_bdev_module bdev_ut_if = {
|
||||||
.name = "bdev_ut",
|
.name = "bdev_ut",
|
||||||
.module_init = module_init,
|
.module_init = module_init,
|
||||||
.module_fini = module_fini,
|
.module_fini = module_fini,
|
||||||
|
.init_complete = init_complete,
|
||||||
};
|
};
|
||||||
|
|
||||||
SPDK_BDEV_MODULE_REGISTER(&bdev_ut_if)
|
SPDK_BDEV_MODULE_REGISTER(&bdev_ut_if)
|
||||||
@ -281,7 +289,9 @@ bdev_io_tailq_cnt(bdev_io_tailq_t *tailq)
|
|||||||
static void
|
static void
|
||||||
basic(void)
|
basic(void)
|
||||||
{
|
{
|
||||||
|
g_init_complete_called = false;
|
||||||
setup_test();
|
setup_test();
|
||||||
|
CU_ASSERT(g_init_complete_called == true);
|
||||||
|
|
||||||
set_thread(0);
|
set_thread(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user