bdev/nvme: Separate nvme_ctrlr_create_bdevs from create_ctrlr
Separating these two functions will make possible to use create_ctrlr function for othe NVMe bdev types in the future. Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: I3d503a3bf0d317f77beeb827c761b93d66a643ea Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468593 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
c94ecfaedc
commit
3fb65d7b9d
@ -993,8 +993,6 @@ create_ctrlr(struct spdk_nvme_ctrlr *ctrlr,
|
|||||||
sizeof(struct nvme_io_channel),
|
sizeof(struct nvme_io_channel),
|
||||||
name);
|
name);
|
||||||
|
|
||||||
nvme_ctrlr_create_bdevs(nvme_bdev_ctrlr);
|
|
||||||
|
|
||||||
nvme_bdev_ctrlr->adminq_timer_poller = spdk_poller_register(bdev_nvme_poll_adminq, ctrlr,
|
nvme_bdev_ctrlr->adminq_timer_poller = spdk_poller_register(bdev_nvme_poll_adminq, ctrlr,
|
||||||
g_opts.nvme_adminq_poll_period_us);
|
g_opts.nvme_adminq_poll_period_us);
|
||||||
|
|
||||||
@ -1019,6 +1017,7 @@ static void
|
|||||||
attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||||
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
|
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
|
||||||
{
|
{
|
||||||
|
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr;
|
||||||
struct nvme_probe_ctx *ctx = cb_ctx;
|
struct nvme_probe_ctx *ctx = cb_ctx;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
uint32_t prchk_flags = 0;
|
uint32_t prchk_flags = 0;
|
||||||
@ -1044,6 +1043,15 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
|||||||
|
|
||||||
create_ctrlr(ctrlr, name, trid, prchk_flags);
|
create_ctrlr(ctrlr, name, trid, prchk_flags);
|
||||||
|
|
||||||
|
nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(trid);
|
||||||
|
if (!nvme_bdev_ctrlr) {
|
||||||
|
SPDK_ERRLOG("Failed to find new NVMe controller\n");
|
||||||
|
free(name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nvme_ctrlr_create_bdevs(nvme_bdev_ctrlr);
|
||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,6 +1213,8 @@ bdev_nvme_create_and_get_bdev_names(struct spdk_nvme_ctrlr *ctrlr,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvme_ctrlr_create_bdevs(nvme_bdev_ctrlr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Report the new bdevs that were created in this call.
|
* Report the new bdevs that were created in this call.
|
||||||
* There can be more than one bdev per NVMe controller since one bdev is created per namespace.
|
* There can be more than one bdev per NVMe controller since one bdev is created per namespace.
|
||||||
@ -1384,6 +1394,7 @@ spdk_bdev_nvme_delete(const char *name)
|
|||||||
static int
|
static int
|
||||||
bdev_nvme_library_init(void)
|
bdev_nvme_library_init(void)
|
||||||
{
|
{
|
||||||
|
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr;
|
||||||
struct spdk_conf_section *sp;
|
struct spdk_conf_section *sp;
|
||||||
const char *val;
|
const char *val;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@ -1544,6 +1555,15 @@ bdev_nvme_library_init(void)
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(&probe_ctx->trids[i]);
|
||||||
|
if (!nvme_bdev_ctrlr) {
|
||||||
|
SPDK_ERRLOG("Failed to find new NVMe controller\n");
|
||||||
|
rc = -ENODEV;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
nvme_ctrlr_create_bdevs(nvme_bdev_ctrlr);
|
||||||
} else {
|
} else {
|
||||||
local_nvme_num++;
|
local_nvme_num++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user