lib/nvme: split request resubmission into function.
This will need to be done separately for poll groups. Signed-off-by: Seth Howell <seth.howell@intel.com> Change-Id: I0e432493bdb02e13fe5c73a8a09911cef573307b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1664 Community-CI: Mellanox Build Bot 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> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
63732d8880
commit
684b3a49f0
@ -925,6 +925,7 @@ void nvme_qpair_complete_error_reqs(struct spdk_nvme_qpair *qpair);
|
||||
int nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair,
|
||||
struct nvme_request *req);
|
||||
void nvme_qpair_abort_reqs(struct spdk_nvme_qpair *qpair, uint32_t dnr);
|
||||
void nvme_qpair_resubmit_requests(struct spdk_nvme_qpair *qpair, uint32_t num_requests);
|
||||
|
||||
int nvme_ctrlr_identify_active_ns(struct spdk_nvme_ctrlr *ctrlr);
|
||||
void nvme_ns_set_identify_data(struct spdk_nvme_ns *ns);
|
||||
|
@ -454,12 +454,33 @@ nvme_qpair_check_enabled(struct spdk_nvme_qpair *qpair)
|
||||
return nvme_qpair_get_state(qpair) == NVME_QPAIR_ENABLED;
|
||||
}
|
||||
|
||||
void
|
||||
nvme_qpair_resubmit_requests(struct spdk_nvme_qpair *qpair, uint32_t num_requests)
|
||||
{
|
||||
uint32_t i;
|
||||
int resubmit_rc;
|
||||
struct nvme_request *req;
|
||||
|
||||
for (i = 0; i < num_requests; i++) {
|
||||
if (qpair->ctrlr->is_resetting) {
|
||||
break;
|
||||
}
|
||||
if ((req = STAILQ_FIRST(&qpair->queued_req)) == NULL) {
|
||||
break;
|
||||
}
|
||||
STAILQ_REMOVE_HEAD(&qpair->queued_req, stailq);
|
||||
resubmit_rc = nvme_qpair_resubmit_request(qpair, req);
|
||||
if (spdk_unlikely(resubmit_rc != 0)) {
|
||||
SPDK_ERRLOG("Unable to resubmit as many requests as we completed.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t
|
||||
spdk_nvme_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_completions)
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t resubmit_rc;
|
||||
int32_t i;
|
||||
struct nvme_request *req, *tmp;
|
||||
|
||||
if (spdk_unlikely(qpair->ctrlr->is_failed)) {
|
||||
@ -513,17 +534,7 @@ spdk_nvme_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
|
||||
* At this point, ret must represent the number of completions we reaped.
|
||||
* submit as many queued requests as we completed.
|
||||
*/
|
||||
i = 0;
|
||||
while (i < ret && !STAILQ_EMPTY(&qpair->queued_req) && !qpair->ctrlr->is_resetting) {
|
||||
req = STAILQ_FIRST(&qpair->queued_req);
|
||||
STAILQ_REMOVE_HEAD(&qpair->queued_req, stailq);
|
||||
resubmit_rc = nvme_qpair_resubmit_request(qpair, req);
|
||||
if (spdk_unlikely(resubmit_rc != 0)) {
|
||||
SPDK_ERRLOG("Unable to resubmit as many requests as we completed.\n");
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
nvme_qpair_resubmit_requests(qpair, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user