nvmf: simplify nvmf_process_io_cmd()

Drop the redundant controller ready check.
nvmf_process_io_cmd() was checking CSTS.RDY, but this is not necessary,
since its only caller, spdk_nvmf_request_exec(), is already checking
CC.EN, which always matches RDY in our virtual controller
implementation.

The initialization of status is a dead store -
nvmf_complete_cmd() always writes the full response, and the only other
branch is the return immediately below the call, which also sets status.

Change-Id: I1ec2b8a225a91c4b2997d8ab4f45d050cc216de3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-07-21 16:15:03 -07:00 committed by Benjamin Walker
parent 1f929aa55c
commit fd3f7ee3b3

View File

@ -254,32 +254,18 @@ passthrough:
static bool
nvmf_process_io_cmd(struct spdk_nvmf_request *req)
{
struct nvmf_session *session = req->conn->sess;
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
struct spdk_nvme_cpl *response;
struct spdk_nvmf_subsystem *subsystem = session->subsys;
struct spdk_nvmf_subsystem *subsystem = req->conn->sess->subsys;
int rc;
/* pre-set response details for this command */
response = &req->rsp->nvme_cpl;
response->status.sc = SPDK_NVME_SC_SUCCESS;
/* verify that the contoller is ready to process commands */
if (session->vcprop.csts.bits.rdy == 0) {
SPDK_ERRLOG("Subsystem Controller Not Ready!\n");
response->status.sc = SPDK_NVME_SC_NAMESPACE_NOT_READY;
return true;
}
rc = spdk_nvme_ctrlr_cmd_io_raw(subsystem->ctrlr, subsystem->io_qpair,
cmd,
&req->cmd->nvme_cmd,
req->data, req->length,
nvmf_complete_cmd,
req);
if (rc) {
SPDK_ERRLOG("Failed to submit Opcode 0x%02x\n", cmd->opc);
response->status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
SPDK_ERRLOG("Failed to submit request %p\n", req);
req->rsp->nvme_cpl.status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
return true;
}