nvme: print name of ctrlr state in timeout message

Previously the nvme_ctrlr_state_string() function
was only defined for DEBUG builds since it was only
used in DEBUGLOGs.  So now that we're also using
it for an ERRLOG we need to define this function
in release builds as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic14b251fbd7da1519ad0fd4d8a183d6b6ca17984

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9468
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Jim Harris 2021-09-10 01:10:35 -07:00 committed by Tomasz Zawadzki
parent 7c4a245425
commit e91d7428f9

View File

@ -1213,7 +1213,6 @@ nvme_ctrlr_disable(struct spdk_nvme_ctrlr *ctrlr)
return 0;
}
#ifdef DEBUG
static const char *
nvme_ctrlr_state_string(enum nvme_ctrlr_state state)
{
@ -1299,7 +1298,6 @@ nvme_ctrlr_state_string(enum nvme_ctrlr_state state)
}
return "unknown";
};
#endif /* DEBUG */
static void
nvme_ctrlr_set_state(struct spdk_nvme_ctrlr *ctrlr, enum nvme_ctrlr_state state,
@ -3642,7 +3640,8 @@ init_timeout:
*/
if (ctrlr->state_timeout_tsc != NVME_TIMEOUT_INFINITE &&
ticks > ctrlr->state_timeout_tsc) {
NVME_CTRLR_ERRLOG(ctrlr, "Initialization timed out in state %d\n", ctrlr->state);
NVME_CTRLR_ERRLOG(ctrlr, "Initialization timed out in state %d (%s)\n",
ctrlr->state, nvme_ctrlr_state_string(ctrlr->state));
return -1;
}