nvme: broke up nvme_ctrlr_identify() completion into a function

Change-Id: Ide0c81b1cc29d67cec0c10ab877360db3699141e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/424775
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2018-09-05 22:09:21 -04:00 committed by Jim Harris
parent eb5cb3db16
commit e9b5420f70

View File

@ -790,23 +790,10 @@ spdk_nvme_ctrlr_reset(struct spdk_nvme_ctrlr *ctrlr)
return rc;
}
static int
nvme_ctrlr_identify(struct spdk_nvme_ctrlr *ctrlr)
static void
nvme_ctrlr_identify_done(void *arg, const struct spdk_nvme_cpl *cpl)
{
struct nvme_completion_poll_status status;
int rc;
rc = nvme_ctrlr_cmd_identify(ctrlr, SPDK_NVME_IDENTIFY_CTRLR, 0, 0,
&ctrlr->cdata, sizeof(ctrlr->cdata),
nvme_completion_poll_cb, &status);
if (rc != 0) {
return rc;
}
if (spdk_nvme_wait_for_completion(ctrlr->adminq, &status)) {
SPDK_ERRLOG("nvme_identify_controller failed!\n");
return -ENXIO;
}
struct spdk_nvme_ctrlr *ctrlr = (struct spdk_nvme_ctrlr *)arg;
/*
* Use MDTS to ensure our default max_xfer_size doesn't exceed what the
@ -841,6 +828,27 @@ nvme_ctrlr_identify(struct spdk_nvme_ctrlr *ctrlr)
ctrlr->flags |= SPDK_NVME_CTRLR_SGL_SUPPORTED;
ctrlr->max_sges = nvme_transport_ctrlr_get_max_sges(ctrlr);
}
}
static int
nvme_ctrlr_identify(struct spdk_nvme_ctrlr *ctrlr)
{
struct nvme_completion_poll_status status;
int rc;
rc = nvme_ctrlr_cmd_identify(ctrlr, SPDK_NVME_IDENTIFY_CTRLR, 0, 0,
&ctrlr->cdata, sizeof(ctrlr->cdata),
nvme_completion_poll_cb, &status);
if (rc != 0) {
return rc;
}
if (spdk_nvme_wait_for_completion(ctrlr->adminq, &status)) {
SPDK_ERRLOG("nvme_identify_controller failed!\n");
return -ENXIO;
}
nvme_ctrlr_identify_done(ctrlr, &status.cpl);
return 0;
}