From 34eea269f57b0690ce5edc4dd1e9659cb36e38e6 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 2 Dec 2021 08:05:11 +0900 Subject: [PATCH] nvme: Assume poll_group_disconnect_qpair() succeeds if qpair is in connected_qpairs poll_group_disconnect_qpair() is used only in a single place now and transport_poll_group_disconnect_qpair() always returns 0 for all transport. Let's remove unnecessary processing for return code. Signed-off-by: Shuhei Matsumoto Change-Id: I45d7f8cea2117b3ec00028df234d1eb9ecc65713 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10677 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk --- lib/nvme/nvme_transport.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/nvme/nvme_transport.c b/lib/nvme/nvme_transport.c index d53fa9867e..b10a618630 100644 --- a/lib/nvme/nvme_transport.c +++ b/lib/nvme/nvme_transport.c @@ -752,7 +752,7 @@ int nvme_transport_poll_group_disconnect_qpair(struct spdk_nvme_qpair *qpair) { struct spdk_nvme_transport_poll_group *tgroup; - int rc; + int rc __attribute__((unused)); tgroup = qpair->poll_group; @@ -762,16 +762,13 @@ nvme_transport_poll_group_disconnect_qpair(struct spdk_nvme_qpair *qpair) if (qpair->poll_group_tailq_head == &tgroup->connected_qpairs) { rc = tgroup->transport->ops.poll_group_disconnect_qpair(qpair); - if (rc == 0) { - qpair->poll_group_tailq_head = &tgroup->disconnected_qpairs; - STAILQ_REMOVE(&tgroup->connected_qpairs, qpair, spdk_nvme_qpair, poll_group_stailq); - STAILQ_INSERT_TAIL(&tgroup->disconnected_qpairs, qpair, poll_group_stailq); - /* EINPROGRESS indicates that a call has already been made to this function. - * It just keeps us from segfaulting on a double removal/insert. - */ - } + assert(rc == 0); - return rc == -EINPROGRESS ? 0 : rc; + qpair->poll_group_tailq_head = &tgroup->disconnected_qpairs; + STAILQ_REMOVE(&tgroup->connected_qpairs, qpair, spdk_nvme_qpair, poll_group_stailq); + STAILQ_INSERT_TAIL(&tgroup->disconnected_qpairs, qpair, poll_group_stailq); + + return 0; } return -EINVAL;