nvme: move nvme_qpair_fail() call to generic code

The logic to fail queue pairs when the controller is failed should be
handled in the generic code, not in the individual transports.

This also allows nvme_qpair_fail() to be private to nvme_qpair.c.

Change-Id: I6194576dceb35073b9af8847e59314900028637c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-01-30 16:40:39 -07:00 committed by Jim Harris
parent b71c31335d
commit a384110d7a
5 changed files with 8 additions and 17 deletions

View File

@ -535,7 +535,6 @@ void nvme_qpair_enable(struct spdk_nvme_qpair *qpair);
void nvme_qpair_disable(struct spdk_nvme_qpair *qpair);
int nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair,
struct nvme_request *req);
void nvme_qpair_fail(struct spdk_nvme_qpair *qpair);
int nvme_ns_construct(struct spdk_nvme_ns *ns, uint16_t id,
struct spdk_nvme_ctrlr *ctrlr);

View File

@ -1866,11 +1866,6 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
uint32_t num_completions = 0;
struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
if (qpair->ctrlr->is_failed) {
nvme_qpair_fail(qpair);
return 0;
}
if (!nvme_pcie_qpair_check_enabled(qpair)) {
/*
* qpair is not enabled, likely because a controller reset is

View File

@ -33,6 +33,8 @@
#include "nvme_internal.h"
static void nvme_qpair_fail(struct spdk_nvme_qpair *qpair);
struct nvme_string {
uint16_t value;
const char *str;
@ -336,6 +338,11 @@ nvme_qpair_manual_complete_request(struct spdk_nvme_qpair *qpair,
int32_t
spdk_nvme_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_completions)
{
if (qpair->ctrlr->is_failed) {
nvme_qpair_fail(qpair);
return 0;
}
return nvme_transport_qpair_process_completions(qpair, max_completions);
}
@ -421,7 +428,7 @@ nvme_qpair_disable(struct spdk_nvme_qpair *qpair)
nvme_transport_qpair_disable(qpair);
}
void
static void
nvme_qpair_fail(struct spdk_nvme_qpair *qpair)
{
struct nvme_request *req;

View File

@ -211,11 +211,6 @@ spdk_nvme_ctrlr_cmd_get_log_page(struct spdk_nvme_ctrlr *ctrlr, uint8_t log_page
return 0;
}
void
nvme_qpair_fail(struct spdk_nvme_qpair *qpair)
{
}
int
nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_request *req)
{

View File

@ -65,11 +65,6 @@ struct io_request {
bool invalid_second_addr;
};
void
nvme_qpair_fail(struct spdk_nvme_qpair *qpair)
{
}
void
nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)
{