From 913bd6b6ef95281d739308603b69c10f649bd32b Mon Sep 17 00:00:00 2001 From: Maciej Szwed Date: Wed, 27 Feb 2019 15:21:41 +0100 Subject: [PATCH] bdev/nvme: Remove spdk_bdev_nvme_lookup_ctrlr function spdk_bdev_nvme_lookup_ctrlr can be replaced with existing nvme_bdev_ctrlr_get_by_name function. Signed-off-by: Maciej Szwed Change-Id: Id85243b13099b2976e1368e481201ccf27ce6ddb Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446437 Tested-by: SPDK CI Jenkins Reviewed-by: Paul Luse Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/bdev/nvme/bdev_nvme.c | 14 -------------- lib/bdev/nvme/bdev_nvme.h | 1 - lib/bdev/nvme/bdev_nvme_rpc.c | 2 +- lib/bdev/nvme/nvme_rpc.c | 2 +- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/lib/bdev/nvme/bdev_nvme.c b/lib/bdev/nvme/bdev_nvme.c index ec5b077b50..f54c27b8bb 100644 --- a/lib/bdev/nvme/bdev_nvme.c +++ b/lib/bdev/nvme/bdev_nvme.c @@ -150,20 +150,6 @@ spdk_bdev_nvme_get_io_qpair(struct spdk_io_channel *ctrlr_io_ch) return nvme_ch->qpair; } -struct nvme_bdev_ctrlr * -spdk_bdev_nvme_lookup_ctrlr(const char *ctrlr_name) -{ - struct nvme_bdev_ctrlr *_nvme_ctrlr; - - TAILQ_FOREACH(_nvme_ctrlr, &g_nvme_bdev_ctrlrs, tailq) { - if (strcmp(ctrlr_name, _nvme_ctrlr->name) == 0) { - return _nvme_ctrlr; - } - } - - return NULL; -} - struct nvme_bdev_ctrlr * spdk_bdev_nvme_first_ctrlr(void) { diff --git a/lib/bdev/nvme/bdev_nvme.h b/lib/bdev/nvme/bdev_nvme.h index 3753020b93..327d5042a4 100644 --- a/lib/bdev/nvme/bdev_nvme.h +++ b/lib/bdev/nvme/bdev_nvme.h @@ -57,7 +57,6 @@ void spdk_bdev_nvme_dump_trid_json(struct spdk_nvme_transport_id *trid, struct spdk_json_write_ctx *w); struct spdk_nvme_qpair *spdk_bdev_nvme_get_io_qpair(struct spdk_io_channel *ctrlr_io_ch); -struct nvme_bdev_ctrlr *spdk_bdev_nvme_lookup_ctrlr(const char *ctrlr_name); struct nvme_bdev_ctrlr *spdk_bdev_nvme_first_ctrlr(void); struct nvme_bdev_ctrlr *spdk_bdev_nvme_next_ctrlr(struct nvme_bdev_ctrlr *prev); void spdk_bdev_nvme_get_opts(struct spdk_bdev_nvme_opts *opts); diff --git a/lib/bdev/nvme/bdev_nvme_rpc.c b/lib/bdev/nvme/bdev_nvme_rpc.c index b042fcac4a..9b5a88b24b 100644 --- a/lib/bdev/nvme/bdev_nvme_rpc.c +++ b/lib/bdev/nvme/bdev_nvme_rpc.c @@ -347,7 +347,7 @@ spdk_rpc_get_nvme_controllers(struct spdk_jsonrpc_request *request, } if (req.name) { - ctrlr = spdk_bdev_nvme_lookup_ctrlr(req.name); + ctrlr = nvme_bdev_ctrlr_get_by_name(req.name); if (ctrlr == NULL) { SPDK_ERRLOG("ctrlr '%s' does not exist\n", req.name); goto invalid; diff --git a/lib/bdev/nvme/nvme_rpc.c b/lib/bdev/nvme/nvme_rpc.c index 23fa524dc5..66e4180c71 100644 --- a/lib/bdev/nvme/nvme_rpc.c +++ b/lib/bdev/nvme/nvme_rpc.c @@ -461,7 +461,7 @@ spdk_rpc_send_nvme_cmd(struct spdk_jsonrpc_request *request, goto invalid; } - ctx->nvme_bdev_ctrlr = spdk_bdev_nvme_lookup_ctrlr(ctx->req.name); + ctx->nvme_bdev_ctrlr = nvme_bdev_ctrlr_get_by_name(ctx->req.name); if (ctx->nvme_bdev_ctrlr == NULL) { SPDK_ERRLOG("Failed at device lookup\n"); error_code = SPDK_JSONRPC_ERROR_INVALID_PARAMS;