Commit 9ffa69dc authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 7ea4a778
Loading
Loading
Loading
Loading
+6 −28
Original line number Diff line number Diff line
@@ -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,
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)
		       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)