nvmf: expose api to remove qpair from internal poll group

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I681327d405f60757c43b66592d9af7bd7ac2db0b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2774
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jacek Kalwas 2020-06-04 16:13:06 +02:00 committed by Tomasz Zawadzki
parent 7b77e06801
commit eb79ef5727
3 changed files with 23 additions and 7 deletions

View File

@ -400,6 +400,13 @@ void spdk_nvmf_request_exec_fabrics(struct spdk_nvmf_request *req);
int spdk_nvmf_request_free(struct spdk_nvmf_request *req);
int spdk_nvmf_request_complete(struct spdk_nvmf_request *req);
/**
* Remove the given qpair from the poll group.
*
* \param qpair The qpair to remove.
*/
void spdk_nvmf_poll_group_remove(struct spdk_nvmf_qpair *qpair);
/**
* Get the NVMe-oF subsystem associated with this controller.
*

View File

@ -880,20 +880,16 @@ _nvmf_ctrlr_free_from_qpair(void *ctx)
free(qpair_ctx);
}
static void
_nvmf_qpair_destroy(void *ctx, int status)
void
spdk_nvmf_poll_group_remove(struct spdk_nvmf_qpair *qpair)
{
struct nvmf_qpair_disconnect_ctx *qpair_ctx = ctx;
struct spdk_nvmf_qpair *qpair = qpair_ctx->qpair;
struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr;
struct spdk_nvmf_transport_poll_group *tgroup;
struct spdk_nvmf_request *req, *tmp;
struct spdk_nvmf_subsystem_poll_group *sgroup;
int rc;
assert(qpair->state == SPDK_NVMF_QPAIR_DEACTIVATING);
nvmf_qpair_set_state(qpair, SPDK_NVMF_QPAIR_ERROR);
qpair_ctx->qid = qpair->qid;
/* Find the tgroup and remove the qpair from the tgroup */
TAILQ_FOREACH(tgroup, &qpair->group->tgroups, link) {
@ -920,6 +916,19 @@ _nvmf_qpair_destroy(void *ctx, int status)
}
TAILQ_REMOVE(&qpair->group->qpairs, qpair, link);
}
static void
_nvmf_qpair_destroy(void *ctx, int status)
{
struct nvmf_qpair_disconnect_ctx *qpair_ctx = ctx;
struct spdk_nvmf_qpair *qpair = qpair_ctx->qpair;
struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr;
assert(qpair->state == SPDK_NVMF_QPAIR_DEACTIVATING);
qpair_ctx->qid = qpair->qid;
spdk_nvmf_poll_group_remove(qpair);
if (!ctrlr || !ctrlr->thread) {
nvmf_transport_qpair_fini(qpair);
@ -932,7 +941,6 @@ _nvmf_qpair_destroy(void *ctx, int status)
qpair_ctx->ctrlr = ctrlr;
spdk_thread_send_msg(ctrlr->thread, _nvmf_ctrlr_free_from_qpair, qpair_ctx);
}
int

View File

@ -107,6 +107,7 @@
spdk_nvmf_request_complete;
spdk_nvmf_ctrlr_get_subsystem;
spdk_nvmf_req_get_xfer;
spdk_nvmf_poll_group_remove;
local: *;