bdev/nvme: Inline _nvme_bdev_ctrlr_create() into nvme_bdev_ctrlr_create()

Inline _nvme_bdev_ctrlr_create() into nvme_bdev_ctrlr_create().

This simplifies the nesting structure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I903a9cee670dc0bf32d272e8c1d18c98a51ade8a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8315
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2021-06-14 05:18:31 +09:00 committed by Tomasz Zawadzki
parent 7ea4a778a3
commit 9ffa69dc75

View File

@ -1807,11 +1807,11 @@ populate_namespaces_cb(struct nvme_async_probe_ctx *ctx, size_t count, int rc)
}
static int
_nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr,
const char *name,
const struct spdk_nvme_transport_id *trid,
uint32_t prchk_flags,
struct nvme_bdev_ctrlr **_nvme_bdev_ctrlr)
nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr,
const char *name,
const struct spdk_nvme_transport_id *trid,
uint32_t prchk_flags,
struct nvme_async_probe_ctx *ctx)
{
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr;
struct nvme_bdev_ctrlr_trid *trid_entry;
@ -1905,9 +1905,7 @@ _nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr,
TAILQ_INSERT_HEAD(&nvme_bdev_ctrlr->trids, trid_entry, link);
if (_nvme_bdev_ctrlr != NULL) {
*_nvme_bdev_ctrlr = nvme_bdev_ctrlr;
}
nvme_ctrlr_populate_namespaces(nvme_bdev_ctrlr, ctx);
return 0;
err_init_ocssd:
@ -1927,26 +1925,6 @@ err_init_mutex:
return rc;
}
static int
nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr,
const char *name,
const struct spdk_nvme_transport_id *trid,
uint32_t prchk_flags,
struct nvme_async_probe_ctx *ctx)
{
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = NULL;
int rc;
rc = _nvme_bdev_ctrlr_create(ctrlr, name, trid, prchk_flags, &nvme_bdev_ctrlr);
if (rc != 0) {
SPDK_ERRLOG("Failed to create new NVMe controller\n");
return rc;
}
nvme_ctrlr_populate_namespaces(nvme_bdev_ctrlr, ctx);
return 0;
}
static void
attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)