bdev: Allow bdev module to finish start asynchronously

Currently if module claims a bdev in examine_config,
it cannot start asynchronously. This patch changes this
behaviour by calling examine_disk on modules which previously
claimed bdev trough examine_config.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I85b603590c6dab50e59ef7e68f292cb9abc47d98

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448132
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Piotr Pelplinski 2019-03-15 10:32:24 +01:00 committed by Jim Harris
parent 40678c15ed
commit 0497ae8ea3
3 changed files with 12 additions and 3 deletions

View File

@ -34,8 +34,8 @@ initialization (`module_init`) and teardown (`module_fini`) functions,
the function that returns context size (`get_ctx_size`) - scratch space that
will be allocated in each I/O request for use by this module, and a callback
that will be called each time a new bdev is registered by another module
(`examine`). Please check the documentation of struct spdk_bdev_module for
more details.
(`examine_config` and `examine_disk`). Please check the documentation of
struct spdk_bdev_module for more details.
## Creating Bdevs

View File

@ -119,7 +119,12 @@ struct spdk_bdev_module {
* First notification that a bdev should be examined by a virtual bdev module.
* Virtual bdev modules may use this to examine newly-added bdevs and automatically
* create their own vbdevs, but no I/O to device can be send to bdev at this point.
* Only vbdevs based on config files can be created here.
* Only vbdevs based on config files can be created here. This callback must make
* its decision to claim the module synchronously.
* It must also call spdk_bdev_module_examine_done() before returning. If the module
* needs to perform asynchronous operations such as I/O after claiming the bdev,
* it may define an examine_disk callback. The examine_disk callback will then
* be called immediately after the examine_config callback returns.
*/
void (*examine_config)(struct spdk_bdev *bdev);

View File

@ -3721,6 +3721,10 @@ spdk_bdev_start(struct spdk_bdev *bdev)
}
if (bdev->internal.claim_module) {
if (bdev->internal.claim_module->examine_disk) {
bdev->internal.claim_module->internal.action_in_progress++;
bdev->internal.claim_module->examine_disk(bdev);
}
return;
}