bdev: refactor bdev_examine before claims v2
This commit has no functional change. It refactors an if statement into a case statement in preparation for supporting claims v2. Signed-off-by: Mike Gerdts <mgerdts@nvidia.com> Change-Id: I1862428c91a7066ad9079878d4c1b690a5ef631c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15289 Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
a7eb6187e5
commit
47bb651cd5
@ -682,25 +682,39 @@ bdev_examine(struct spdk_bdev *bdev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bdev->internal.claim_type != SPDK_BDEV_CLAIM_NONE) {
|
spdk_spin_lock(&bdev->internal.spinlock);
|
||||||
|
|
||||||
|
switch (bdev->internal.claim_type) {
|
||||||
|
case SPDK_BDEV_CLAIM_NONE:
|
||||||
|
/* Examine by all bdev modules */
|
||||||
|
TAILQ_FOREACH(module, &g_bdev_mgr.bdev_modules, internal.tailq) {
|
||||||
|
if (module->examine_disk) {
|
||||||
|
spdk_spin_lock(&module->internal.spinlock);
|
||||||
|
module->internal.action_in_progress++;
|
||||||
|
spdk_spin_unlock(&module->internal.spinlock);
|
||||||
|
spdk_spin_unlock(&bdev->internal.spinlock);
|
||||||
|
module->examine_disk(bdev);
|
||||||
|
spdk_spin_lock(&bdev->internal.spinlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SPDK_BDEV_CLAIM_EXCL_WRITE:
|
||||||
|
/* Examine by the one bdev module with a v1 claim */
|
||||||
module = bdev->internal.claim.v1.module;
|
module = bdev->internal.claim.v1.module;
|
||||||
if (module->examine_disk) {
|
if (module->examine_disk) {
|
||||||
spdk_spin_lock(&module->internal.spinlock);
|
spdk_spin_lock(&module->internal.spinlock);
|
||||||
module->internal.action_in_progress++;
|
module->internal.action_in_progress++;
|
||||||
spdk_spin_unlock(&module->internal.spinlock);
|
spdk_spin_unlock(&module->internal.spinlock);
|
||||||
|
spdk_spin_unlock(&bdev->internal.spinlock);
|
||||||
module->examine_disk(bdev);
|
module->examine_disk(bdev);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH(module, &g_bdev_mgr.bdev_modules, internal.tailq) {
|
spdk_spin_unlock(&bdev->internal.spinlock);
|
||||||
if (module->examine_disk) {
|
|
||||||
spdk_spin_lock(&module->internal.spinlock);
|
|
||||||
module->internal.action_in_progress++;
|
|
||||||
spdk_spin_unlock(&module->internal.spinlock);
|
|
||||||
module->examine_disk(bdev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user