nvme: print NVMe command and response when enable nvme log flag

Fix issue #2010.

Change-Id: I9ffc77ddfececce1e6bdac49939d616d9e7bb3c0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8493
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Changpeng Liu 2021-06-24 20:40:41 +08:00 committed by Jim Harris
parent bb8102b1ff
commit 15beaa20bf
2 changed files with 9 additions and 1 deletions

View File

@ -633,6 +633,7 @@ nvme_pcie_qpair_complete_tracker(struct spdk_nvme_qpair *qpair, struct nvme_trac
struct nvme_request *req;
bool retry, error;
bool req_from_current_proc = true;
bool print_error;
req = tr->req;
@ -641,9 +642,13 @@ nvme_pcie_qpair_complete_tracker(struct spdk_nvme_qpair *qpair, struct nvme_trac
error = spdk_nvme_cpl_is_error(cpl);
retry = error && nvme_completion_is_retry(cpl) &&
req->retries < pqpair->retry_count;
print_error = error && print_on_error && !qpair->ctrlr->opts.disable_error_logging;
if (error && print_on_error && !qpair->ctrlr->opts.disable_error_logging) {
if (print_error) {
spdk_nvme_qpair_print_command(qpair, &req->cmd);
}
if (print_error || SPDK_DEBUGLOG_FLAG_ENABLED("nvme")) {
spdk_nvme_qpair_print_completion(qpair, cpl);
}

View File

@ -936,6 +936,9 @@ _nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_request *r
}
if (spdk_likely(rc == 0)) {
if (SPDK_DEBUGLOG_FLAG_ENABLED("nvme")) {
spdk_nvme_print_command(qpair->id, &req->cmd);
}
req->queued = false;
return 0;
}