Commit 0497ae8e authored by Piotr Pelplinski's avatar Piotr Pelplinski Committed by Jim Harris
Browse files

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: default avatarPiotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I85b603590c6dab50e59ef7e68f292cb9abc47d98

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448132


Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 40678c15
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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

+6 −1
Original line number Diff line number Diff line
@@ -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);

+4 −0
Original line number Diff line number Diff line
@@ -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;
	}