From 743292aa0f1a73681184a20effb40b7509de2a04 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 26 Nov 2019 11:27:12 -0700 Subject: [PATCH] bdev/nvme: move code to nvme_ctrlr_populate_namespaces_done This is in preparation for making this code path asynchronous. Signed-off-by: Jim Harris Change-Id: Ifd0ca2a997f5d89307deb7ae686480544fb73140 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475922 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki Reviewed-by: Konrad Sztyber Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- module/bdev/nvme/bdev_nvme.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 862c7e2fb..da7d81b24 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -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)