bdev/nvme: reuse nvme_ctrlr_depopulate_namespace
Let's reuse this function in the remove path, to avoid some code duplication. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I33519e093dafc71e7ccb6aad40638d33a820a0a5 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475798 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
922fc42418
commit
d1f8893968
@ -1210,7 +1210,6 @@ remove_cb(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr)
|
||||
uint32_t i;
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr;
|
||||
struct nvme_bdev_ns *ns;
|
||||
struct nvme_bdev *nvme_bdev, *tmp;
|
||||
|
||||
pthread_mutex_lock(&g_bdev_nvme_mutex);
|
||||
TAILQ_FOREACH(nvme_bdev_ctrlr, &g_nvme_bdev_ctrlrs, tailq) {
|
||||
@ -1227,10 +1226,7 @@ remove_cb(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr)
|
||||
ns = nvme_bdev_ctrlr->namespaces[nsid - 1];
|
||||
if (ns->populated) {
|
||||
assert(ns->id == nsid);
|
||||
ns->populated = false;
|
||||
TAILQ_FOREACH_SAFE(nvme_bdev, &ns->bdevs, tailq, tmp) {
|
||||
spdk_bdev_unregister(&nvme_bdev->disk, NULL, NULL);
|
||||
}
|
||||
nvme_ctrlr_depopulate_namespace(ns);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user