bdev/nvme: Use probe context as an argument for bdev_nvme_create_bdevs
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: Ib7cbbe9858421761dfb608b04bd9490ddf65cd7f Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470123 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
dd710e6437
commit
e4f9509be5
@ -1190,15 +1190,14 @@ spdk_bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_msg_fn cb, voi
|
||||
}
|
||||
|
||||
static int
|
||||
bdev_nvme_create_bdevs(const char **names, size_t *count,
|
||||
const struct spdk_nvme_transport_id *trid)
|
||||
bdev_nvme_create_bdevs(struct nvme_async_probe_ctx *ctx)
|
||||
{
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr;
|
||||
struct nvme_bdev *nvme_bdev;
|
||||
uint32_t i, nsid;
|
||||
size_t j;
|
||||
|
||||
nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(trid);
|
||||
nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(&ctx->trid);
|
||||
assert(nvme_bdev_ctrlr != NULL);
|
||||
|
||||
nvme_ctrlr_create_bdevs(nvme_bdev_ctrlr);
|
||||
@ -1215,17 +1214,17 @@ bdev_nvme_create_bdevs(const char **names, size_t *count,
|
||||
continue;
|
||||
}
|
||||
assert(nvme_bdev->id == nsid);
|
||||
if (j < *count) {
|
||||
names[j] = nvme_bdev->disk.name;
|
||||
if (j < *ctx->count) {
|
||||
ctx->names[j] = nvme_bdev->disk.name;
|
||||
j++;
|
||||
} else {
|
||||
SPDK_ERRLOG("Maximum number of namespaces supported per NVMe controller is %zu. Unable to return all names of created bdevs\n",
|
||||
*count);
|
||||
*ctx->count);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
*count = j;
|
||||
*ctx->count = j;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1246,7 +1245,7 @@ connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
goto end;
|
||||
}
|
||||
|
||||
rc = bdev_nvme_create_bdevs(ctx->names, ctx->count, &ctx->trid);
|
||||
rc = bdev_nvme_create_bdevs(ctx);
|
||||
if (rc) {
|
||||
SPDK_ERRLOG("Failed to create bdevs\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user