From 619acff501b4583678d6468483f0366fa43029d0 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Mon, 29 Nov 2021 00:13:38 +0900 Subject: [PATCH] bdev/nvme: Delete unused nvme_probe_ctx We set cb_ctx to NULL when calling spdk_nvme_probe_async(). It looks that nvme_probe_ctx has not been used anywhere for a long time. nvme_probe_ctx is not public data structure. Remove nvme_probe_ctx to simplify the code and make the following patches easier. Signed-off-by: Shuhei Matsumoto Change-Id: I7dd5f970a7fde1c9c189fae3c8f28f84d7aed991 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10554 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Reviewed-by: Ben Walker Reviewed-by: Tomasz Zawadzki --- module/bdev/nvme/bdev_nvme.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index debeef420b..27fb1b39de 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -113,15 +113,6 @@ struct nvme_bdev_io { int32_t retry_count; }; -struct nvme_probe_ctx { - size_t count; - struct spdk_nvme_transport_id trids[NVME_MAX_CONTROLLERS]; - struct spdk_nvme_host_id hostids[NVME_MAX_CONTROLLERS]; - const char *names[NVME_MAX_CONTROLLERS]; - uint32_t prchk_flags[NVME_MAX_CONTROLLERS]; - const char *hostnqn; -}; - struct nvme_probe_skip_entry { struct spdk_nvme_transport_id trid; TAILQ_ENTRY(nvme_probe_skip_entry) tailq; @@ -3286,22 +3277,9 @@ 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) { - struct nvme_probe_ctx *ctx = cb_ctx; - char *name = NULL; - uint32_t prchk_flags = 0; - size_t i; + char *name; - if (ctx) { - for (i = 0; i < ctx->count; i++) { - if (spdk_nvme_transport_id_compare(trid, &ctx->trids[i]) == 0) { - prchk_flags = ctx->prchk_flags[i]; - name = strdup(ctx->names[i]); - break; - } - } - } else { - name = spdk_sprintf_alloc("HotInNvme%d", g_hot_insert_nvme_controller_index++); - } + name = spdk_sprintf_alloc("HotInNvme%d", g_hot_insert_nvme_controller_index++); if (!name) { SPDK_ERRLOG("Failed to assign name to NVMe device\n"); return; @@ -3309,7 +3287,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, SPDK_DEBUGLOG(bdev_nvme, "Attached to %s (%s)\n", trid->traddr, name); - nvme_ctrlr_create(ctrlr, name, trid, prchk_flags, NULL); + nvme_ctrlr_create(ctrlr, name, trid, 0, NULL); free(name); }