From cd820331a2c8959ec1c9101aeaaf30703c73b9da Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 24 Mar 2021 19:46:38 +0900 Subject: [PATCH] bdev/nvme: Move up populate_namespaces_cb() in a file This will reduce the size of the following patches. Signed-off-by: Shuhei Matsumoto Change-Id: I81d7c90d8676a42aff3ffe73932d5612642a4114 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7042 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Paul Luse Reviewed-by: Aleksey Marchuk Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- module/bdev/nvme/bdev_nvme.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 1fbb19ff9..67115a029 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -1698,6 +1698,23 @@ aer_cb(void *arg, const struct spdk_nvme_cpl *cpl) } } +static void +populate_namespaces_cb(struct nvme_async_probe_ctx *ctx, size_t count, int rc) +{ + if (ctx->cb_fn) { + ctx->cb_fn(ctx->cb_ctx, count, rc); + } + + ctx->namespaces_populated = true; + if (ctx->probe_done) { + /* The probe was already completed, so we need to free the context + * here. This can happen for cases like OCSSD, where we need to + * send additional commands to the SSD after attach. + */ + free(ctx); + } +} + static int nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr, const char *name, @@ -2019,23 +2036,6 @@ bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_msg_fn cb, void *cb return 0; } -static void -populate_namespaces_cb(struct nvme_async_probe_ctx *ctx, size_t count, int rc) -{ - if (ctx->cb_fn) { - ctx->cb_fn(ctx->cb_ctx, count, rc); - } - - ctx->namespaces_populated = true; - if (ctx->probe_done) { - /* The probe was already completed, so we need to free the context - * here. This can happen for cases like OCSSD, where we need to - * send additional commands to the SSD after attach. - */ - free(ctx); - } -} - static void nvme_ctrlr_populate_namespaces_done(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct nvme_async_probe_ctx *ctx)