Commit 743292aa authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

bdev/nvme: move code to nvme_ctrlr_populate_namespaces_done



This is in preparation for making this code path asynchronous.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ifd0ca2a997f5d89307deb7ae686480544fb73140

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475922


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent d3726b6e
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -1349,7 +1349,7 @@ populate_namespaces_cb(struct nvme_async_probe_ctx *ctx, size_t count, int rc)
}

static void
bdev_nvme_populate_namespaces(struct nvme_async_probe_ctx *ctx)
nvme_ctrlr_populate_namespaces_done(struct nvme_async_probe_ctx *ctx)
{
	struct nvme_bdev_ctrlr	*nvme_bdev_ctrlr;
	struct nvme_bdev_ns	*ns;
@@ -1358,9 +1358,6 @@ bdev_nvme_populate_namespaces(struct nvme_async_probe_ctx *ctx)
	size_t			j;

	nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(&ctx->trid);
	assert(nvme_bdev_ctrlr != NULL);

	nvme_ctrlr_populate_namespaces(nvme_bdev_ctrlr, ctx);

	/*
	 * Report the new bdevs that were created in this call.
@@ -1390,6 +1387,18 @@ bdev_nvme_populate_namespaces(struct nvme_async_probe_ctx *ctx)
	populate_namespaces_cb(ctx, j, 0);
}

static void
bdev_nvme_populate_namespaces(struct nvme_async_probe_ctx *ctx)
{
	struct nvme_bdev_ctrlr	*nvme_bdev_ctrlr;

	nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(&ctx->trid);
	assert(nvme_bdev_ctrlr != NULL);

	nvme_ctrlr_populate_namespaces(nvme_bdev_ctrlr, ctx);
	nvme_ctrlr_populate_namespaces_done(ctx);
}

static void
connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
		  struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)