bdev/nvme: Save probe_ctx in nvme_ns and populate_namespace_done() refer it
nvme_ctrlr_populate_namespace_done() needs nvme_ns, probe_ctx, and completion status. When multipath is supported, nvme_ctrlr_populate_namespace_done() will be called from the spdk_for_each_channel() callback. The spdk_for_each_channel() callback can have one context and one completion status. Hence nvme_ns or probe_ctx need to have another. If an nvme_ctrlr has multiple namespaces, a probe_ctx is shared by multiple nvme_ns. So let nvme_ns has probe_ctx. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Iedaaab80616d34d01935f4ebc31e1f3b84e09e32 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9047 Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
fbbc8c4f81
commit
b0a6496a7b
@ -1929,12 +1929,13 @@ timeout_cb(void *cb_arg, struct spdk_nvme_ctrlr *ctrlr,
|
||||
}
|
||||
|
||||
static void
|
||||
nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
|
||||
struct nvme_ns *nvme_ns, int rc)
|
||||
nvme_ctrlr_populate_namespace_done(struct nvme_ns *nvme_ns, int rc)
|
||||
{
|
||||
struct nvme_ctrlr *nvme_ctrlr = nvme_ns->ctrlr;
|
||||
struct nvme_async_probe_ctx *ctx = nvme_ns->probe_ctx;
|
||||
|
||||
if (rc == 0) {
|
||||
nvme_ns->probe_ctx = NULL;
|
||||
pthread_mutex_lock(&nvme_ctrlr->mutex);
|
||||
nvme_ctrlr->ref++;
|
||||
pthread_mutex_unlock(&nvme_ctrlr->mutex);
|
||||
@ -1952,8 +1953,7 @@ nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
|
||||
}
|
||||
|
||||
static void
|
||||
nvme_ctrlr_populate_namespace(struct nvme_ctrlr *nvme_ctrlr, struct nvme_ns *nvme_ns,
|
||||
struct nvme_async_probe_ctx *ctx)
|
||||
nvme_ctrlr_populate_namespace(struct nvme_ctrlr *nvme_ctrlr, struct nvme_ns *nvme_ns)
|
||||
{
|
||||
struct spdk_nvme_ctrlr *ctrlr = nvme_ctrlr->ctrlr;
|
||||
struct spdk_nvme_ns *ns;
|
||||
@ -1976,7 +1976,7 @@ 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);
|
||||
nvme_ctrlr_populate_namespace_done(nvme_ns, rc);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2089,7 +2089,9 @@ nvme_ctrlr_populate_namespaces(struct nvme_ctrlr *nvme_ctrlr,
|
||||
if (ctx) {
|
||||
ctx->populates_in_progress++;
|
||||
}
|
||||
nvme_ctrlr_populate_namespace(nvme_ctrlr, nvme_ns, ctx);
|
||||
nvme_ns->probe_ctx = ctx;
|
||||
|
||||
nvme_ctrlr_populate_namespace(nvme_ctrlr, nvme_ns);
|
||||
}
|
||||
|
||||
nsid = spdk_nvme_ctrlr_get_next_active_ns(ctrlr, nsid);
|
||||
|
@ -67,12 +67,13 @@ struct nvme_async_probe_ctx {
|
||||
};
|
||||
|
||||
struct nvme_ns {
|
||||
uint32_t id;
|
||||
struct spdk_nvme_ns *ns;
|
||||
struct nvme_ctrlr *ctrlr;
|
||||
struct nvme_bdev *bdev;
|
||||
uint32_t ana_group_id;
|
||||
enum spdk_nvme_ana_state ana_state;
|
||||
uint32_t id;
|
||||
struct spdk_nvme_ns *ns;
|
||||
struct nvme_ctrlr *ctrlr;
|
||||
struct nvme_bdev *bdev;
|
||||
uint32_t ana_group_id;
|
||||
enum spdk_nvme_ana_state ana_state;
|
||||
struct nvme_async_probe_ctx *probe_ctx;
|
||||
};
|
||||
|
||||
struct nvme_bdev_io;
|
||||
|
Loading…
Reference in New Issue
Block a user