diff --git a/include/spdk/nvmf.h b/include/spdk/nvmf.h index 1f05d5c83e..ff1aab4d75 100644 --- a/include/spdk/nvmf.h +++ b/include/spdk/nvmf.h @@ -180,17 +180,6 @@ void spdk_nvmf_poll_group_destroy(struct spdk_nvmf_poll_group *group); int spdk_nvmf_poll_group_add(struct spdk_nvmf_poll_group *group, struct spdk_nvmf_qpair *qpair); -/** - * Remove the given qpair from the poll group. - * - * \param group The group to delete qpair from. - * \param qpair The qpair to remove. - * - * \return 0 on success, -1 on failure. - */ -int spdk_nvmf_poll_group_remove(struct spdk_nvmf_poll_group *group, - struct spdk_nvmf_qpair *qpair); - typedef void (*nvmf_qpair_disconnect_cb)(void *ctx); /** diff --git a/lib/nvmf/nvmf.c b/lib/nvmf/nvmf.c index 37d2272793..346d3fed9e 100644 --- a/lib/nvmf/nvmf.c +++ b/lib/nvmf/nvmf.c @@ -635,27 +635,6 @@ spdk_nvmf_poll_group_add(struct spdk_nvmf_poll_group *group, return rc; } -int -spdk_nvmf_poll_group_remove(struct spdk_nvmf_poll_group *group, - struct spdk_nvmf_qpair *qpair) -{ - int rc = -1; - struct spdk_nvmf_transport_poll_group *tgroup; - - TAILQ_REMOVE(&group->qpairs, qpair, link); - - qpair->group = NULL; - - TAILQ_FOREACH(tgroup, &group->tgroups, link) { - if (tgroup->transport == qpair->transport) { - rc = spdk_nvmf_transport_poll_group_remove(tgroup, qpair); - break; - } - } - - return rc; -} - static void _nvmf_ctrlr_destruct(void *ctx) { @@ -698,7 +677,9 @@ _spdk_nvmf_qpair_destroy(void *ctx, int status) /* store the thread of admin_qpair and use it later */ thread = ctrlr->admin_qpair->group->thread; } - spdk_nvmf_poll_group_remove(qpair->group, qpair); + + TAILQ_REMOVE(&qpair->group->qpairs, qpair, link); + qpair->group = NULL; assert(qpair->state == SPDK_NVMF_QPAIR_DEACTIVATING); qpair->state = SPDK_NVMF_QPAIR_INACTIVE; diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index 5c66549817..8e3b230aab 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -2301,48 +2301,6 @@ spdk_nvmf_rdma_poll_group_add(struct spdk_nvmf_transport_poll_group *group, return 0; } -static int -spdk_nvmf_rdma_poll_group_remove(struct spdk_nvmf_transport_poll_group *group, - struct spdk_nvmf_qpair *qpair) -{ - struct spdk_nvmf_rdma_poll_group *rgroup; - struct spdk_nvmf_rdma_qpair *rqpair; - struct spdk_nvmf_rdma_device *device; - struct spdk_nvmf_rdma_poller *poller; - struct spdk_nvmf_rdma_qpair *rq, *trq; - - rgroup = SPDK_CONTAINEROF(group, struct spdk_nvmf_rdma_poll_group, group); - rqpair = SPDK_CONTAINEROF(qpair, struct spdk_nvmf_rdma_qpair, qpair); - - device = rqpair->port->device; - - TAILQ_FOREACH(poller, &rgroup->pollers, link) { - if (poller->device == device) { - break; - } - } - - if (!poller) { - SPDK_ERRLOG("No poller found for device.\n"); - return -1; - } - - TAILQ_FOREACH_SAFE(rq, &poller->qpairs, link, trq) { - if (rq == rqpair) { - TAILQ_REMOVE(&poller->qpairs, rqpair, link); - rqpair->poller = NULL; - break; - } - } - - if (rq == NULL) { - SPDK_ERRLOG("RDMA qpair cannot be removed from group (not in group).\n"); - return -1; - } - - return 0; -} - static int spdk_nvmf_rdma_request_free(struct spdk_nvmf_request *req) { @@ -2571,7 +2529,6 @@ const struct spdk_nvmf_transport_ops spdk_nvmf_transport_rdma = { .poll_group_create = spdk_nvmf_rdma_poll_group_create, .poll_group_destroy = spdk_nvmf_rdma_poll_group_destroy, .poll_group_add = spdk_nvmf_rdma_poll_group_add, - .poll_group_remove = spdk_nvmf_rdma_poll_group_remove, .poll_group_poll = spdk_nvmf_rdma_poll_group_poll, .req_free = spdk_nvmf_rdma_request_free, diff --git a/lib/nvmf/transport.c b/lib/nvmf/transport.c index 6e9e5ae457..eac0efba5c 100644 --- a/lib/nvmf/transport.c +++ b/lib/nvmf/transport.c @@ -147,13 +147,6 @@ spdk_nvmf_transport_poll_group_add(struct spdk_nvmf_transport_poll_group *group, return group->transport->ops->poll_group_add(group, qpair); } -int -spdk_nvmf_transport_poll_group_remove(struct spdk_nvmf_transport_poll_group *group, - struct spdk_nvmf_qpair *qpair) -{ - return group->transport->ops->poll_group_remove(group, qpair); -} - int spdk_nvmf_transport_poll_group_poll(struct spdk_nvmf_transport_poll_group *group) { diff --git a/lib/nvmf/transport.h b/lib/nvmf/transport.h index beedba3861..6d39a563a5 100644 --- a/lib/nvmf/transport.h +++ b/lib/nvmf/transport.h @@ -103,12 +103,6 @@ struct spdk_nvmf_transport_ops { int (*poll_group_add)(struct spdk_nvmf_transport_poll_group *group, struct spdk_nvmf_qpair *qpair); - /** - * Remove a qpair from a poll group - */ - int (*poll_group_remove)(struct spdk_nvmf_transport_poll_group *group, - struct spdk_nvmf_qpair *qpair); - /** * Poll the group to process I/O */ @@ -161,9 +155,6 @@ void spdk_nvmf_transport_poll_group_destroy(struct spdk_nvmf_transport_poll_grou int spdk_nvmf_transport_poll_group_add(struct spdk_nvmf_transport_poll_group *group, struct spdk_nvmf_qpair *qpair); -int spdk_nvmf_transport_poll_group_remove(struct spdk_nvmf_transport_poll_group *group, - struct spdk_nvmf_qpair *qpair); - int spdk_nvmf_transport_poll_group_poll(struct spdk_nvmf_transport_poll_group *group); int spdk_nvmf_transport_req_free(struct spdk_nvmf_request *req); diff --git a/test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c b/test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c index e8a4a4b3e5..d808156652 100644 --- a/test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c +++ b/test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c @@ -67,11 +67,6 @@ DEFINE_STUB(spdk_nvmf_poll_group_add, (struct spdk_nvmf_poll_group *group, struct spdk_nvmf_qpair *qpair), 0); -DEFINE_STUB(spdk_nvmf_poll_group_remove, - int, - (struct spdk_nvmf_poll_group *group, struct spdk_nvmf_qpair *qpair), - 0); - DEFINE_STUB(spdk_nvmf_subsystem_get_sn, const char *, (const struct spdk_nvmf_subsystem *subsystem),