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 <smatsumoto@nvidia.com>
Change-Id: I45d7f8cea2117b3ec00028df234d1eb9ecc65713
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10677
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2021-12-02 08:05:11 +09:00 committed by Tomasz Zawadzki
parent 728e3721a4
commit 34eea269f5

View File

@ -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;