bdev/nvme: Remove async callbacks for populating namespaces

Only OCSSD needed this.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I41ee6a08fb4b87a710ca8399545abb9a9622c5be
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9330
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Ben Walker 2021-08-27 13:36:19 -07:00 committed by Tomasz Zawadzki
parent 9a29520be1
commit dcc2a96af9
3 changed files with 24 additions and 48 deletions

View File

@ -1702,31 +1702,8 @@ nvme_ctrlr_populate_namespace(struct nvme_ctrlr *nvme_ctrlr, struct nvme_ns *nvm
}
rc = nvme_bdev_create(nvme_ctrlr, nvme_ns);
done:
nvme_ctrlr_populate_namespace_done(ctx, nvme_ns, rc);
}
static void
nvme_ctrlr_depopulate_namespace(struct nvme_ctrlr *ctrlr, struct nvme_ns *nvme_ns)
{
struct nvme_bdev *bdev;
bdev = nvme_ns->bdev;
if (bdev != NULL) {
spdk_bdev_unregister(&bdev->disk, NULL, NULL);
}
nvme_ctrlr_depopulate_namespace_done(nvme_ns);
}
void
nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
struct nvme_ns *nvme_ns, int rc)
{
struct nvme_ctrlr *nvme_ctrlr = nvme_ns->ctrlr;
assert(nvme_ctrlr != NULL);
if (rc == 0) {
pthread_mutex_lock(&nvme_ctrlr->mutex);
nvme_ctrlr->ref++;
@ -1743,6 +1720,29 @@ nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
}
}
static void
nvme_ctrlr_depopulate_namespace(struct nvme_ctrlr *nvme_ctrlr, struct nvme_ns *nvme_ns)
{
struct nvme_bdev *bdev;
bdev = nvme_ns->bdev;
if (bdev != NULL) {
spdk_bdev_unregister(&bdev->disk, NULL, NULL);
}
pthread_mutex_lock(&nvme_ctrlr->mutex);
nvme_ns->populated = false;
if (nvme_ns->bdev != NULL) {
pthread_mutex_unlock(&nvme_ctrlr->mutex);
return;
}
pthread_mutex_unlock(&nvme_ctrlr->mutex);
nvme_ctrlr_release(nvme_ctrlr);
}
static void
nvme_ctrlr_populate_namespaces(struct nvme_ctrlr *nvme_ctrlr,
struct nvme_async_probe_ctx *ctx)

View File

@ -195,26 +195,6 @@ nvme_ctrlr_release(struct nvme_ctrlr *nvme_ctrlr)
nvme_ctrlr_unregister(nvme_ctrlr);
}
void
nvme_ctrlr_depopulate_namespace_done(struct nvme_ns *nvme_ns)
{
struct nvme_ctrlr *nvme_ctrlr = nvme_ns->ctrlr;
assert(nvme_ctrlr != NULL);
pthread_mutex_lock(&nvme_ctrlr->mutex);
nvme_ns->populated = false;
if (nvme_ns->bdev != NULL) {
pthread_mutex_unlock(&nvme_ctrlr->mutex);
return;
}
pthread_mutex_unlock(&nvme_ctrlr->mutex);
nvme_ctrlr_release(nvme_ctrlr);
}
int
bdev_nvme_create_bdev_channel_cb(void *io_device, void *ctx_buf)
{

View File

@ -174,10 +174,6 @@ struct nvme_bdev_channel {
struct nvme_ctrlr_channel *ctrlr_ch;
};
void nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
struct nvme_ns *nvme_ns, int rc);
void nvme_ctrlr_depopulate_namespace_done(struct nvme_ns *nvme_ns);
struct nvme_ctrlr *nvme_ctrlr_get(const struct spdk_nvme_transport_id *trid);
struct nvme_ctrlr *nvme_ctrlr_get_by_name(const char *name);