bdev/nvme: add nvme_ctrlr_populate_namespace_done()

This is in preparation for making this code path
asynchronous.  For now we will just call this function
immediately after calling the per-ns-type populate
namespace function.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6e397901b2489287634b1d21e57f92e0abcf48e0

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475923
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Jim Harris 2019-11-26 11:39:01 -07:00 committed by Tomasz Zawadzki
parent 394bb22b63
commit 169e19c320
2 changed files with 15 additions and 5 deletions

View File

@ -1030,6 +1030,17 @@ static void nvme_ctrlr_depopulate_namespace(struct nvme_bdev_ctrlr *ctrlr, struc
g_depopulate_namespace_fn[ns->type](ns);
}
void
nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
struct nvme_bdev_ns *ns, int rc)
{
if (rc == 0) {
ns->populated = true;
} else {
memset(ns, 0, sizeof(*ns));
}
}
static void
nvme_ctrlr_populate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
struct nvme_async_probe_ctx *ctx)
@ -1055,11 +1066,7 @@ nvme_ctrlr_populate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
TAILQ_INIT(&ns->bdevs);
rc = nvme_ctrlr_populate_namespace(nvme_bdev_ctrlr, ns, ctx);
if (rc == 0) {
ns->populated = true;
} else {
memset(ns, 0, sizeof(*ns));
}
nvme_ctrlr_populate_namespace_done(ctx, ns, rc);
}
if (ns->populated && !spdk_nvme_ctrlr_is_active_ns(ctrlr, nsid)) {

View File

@ -112,6 +112,9 @@ struct nvme_async_probe_ctx {
void *cb_ctx;
};
void nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
struct nvme_bdev_ns *ns, int rc);
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr_get(const struct spdk_nvme_transport_id *trid);
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr_get_by_name(const char *name);
struct nvme_bdev_ctrlr *nvme_bdev_first_ctrlr(void);