bdev: fix timing of init_complete callback

Recently added a new call to bdev modules to inform them of when
bdev subsystem init is complete. The intention is for modules like
RAID or crypto that need to take some action after the initial bdev
subsystem init such as 'build whatever RAID volumes you can, all
initial examine callbacks are done' or in the case of crypto 'OK,
construct all of your crypto structures for HW and SW PMDs and
associate each to configured vbdevs.'

Now that I've implemented the crypto case I see that the call was
misplaced and will execute following any examine_done call including
subsequent bdev registrations.  Those cases, for both RAID and crypto,
need to follow a different path (examine) since all of the activities
associated with the new init_complete() callback are intended just for
the very first initialization of SPDK.

So, long story short, moving this call so that it's only executed once
when subsystem init is done and not on subsequent bdev registrations.

Change-Id: I952b90e33fc67d48d86c0a7de2ad47c74a98e839
Signed-off-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/408209
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Paul Luse 2018-04-18 07:46:07 -07:00 committed by Daniel Verkamp
parent cb1c88d19f
commit cbb8f46575

View File

@ -484,11 +484,22 @@ spdk_bdev_init_complete(int rc)
{
spdk_bdev_init_cb cb_fn = g_init_cb_fn;
void *cb_arg = g_init_cb_arg;
struct spdk_bdev_module *m;
g_bdev_mgr.init_complete = true;
g_init_cb_fn = NULL;
g_init_cb_arg = NULL;
/*
* 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();
}
}
cb_fn(cb_arg, rc);
}
@ -517,16 +528,6 @@ 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