nvme: add ctrlr option for logging errors

Currently the nvme driver will always log any
request completed with error status.  Some
applications may not want this behavior.  So provide
an option to disable it at the controller level.
When this option is enabled, any failed requests
from queues associated with that controller
(including the admin queue) will not log the
failed request.

Of course the application will still receive
the failed status code and can decide to do its
own logging there.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454081
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2019-05-10 10:40:28 -07:00
parent 0f1ce06deb
commit af38d200e6
4 changed files with 19 additions and 4 deletions

View File

@ -181,6 +181,13 @@ struct spdk_nvme_ctrlr_opts {
* Set to true, means having data digest for the data in the NVMe/TCP PDU
*/
bool data_digest;
/**
* Disable logging of requests that are completed with error status.
*
* Defaults to 'false' (errors are logged).
*/
bool disable_error_logging;
};
/**

View File

@ -161,6 +161,10 @@ spdk_nvme_ctrlr_get_default_ctrlr_opts(struct spdk_nvme_ctrlr_opts *opts, size_t
if (FIELD_OK(data_digest)) {
opts->data_digest = false;
}
if (FIELD_OK(disable_error_logging)) {
opts->disable_error_logging = false;
}
#undef FIELD_OK
}

View File

@ -1296,7 +1296,7 @@ nvme_pcie_qpair_complete_tracker(struct spdk_nvme_qpair *qpair, struct nvme_trac
retry = error && nvme_completion_is_retry(cpl) &&
req->retries < spdk_nvme_retry_count;
if (error && print_on_error) {
if (error && print_on_error && !qpair->ctrlr->opts.disable_error_logging) {
nvme_qpair_print_command(qpair, &req->cmd);
nvme_qpair_print_completion(qpair, cpl);
}
@ -1361,7 +1361,9 @@ nvme_pcie_qpair_abort_trackers(struct spdk_nvme_qpair *qpair, uint32_t dnr)
struct nvme_tracker *tr, *temp;
TAILQ_FOREACH_SAFE(tr, &pqpair->outstanding_tr, tq_list, temp) {
if (!qpair->ctrlr->opts.disable_error_logging) {
SPDK_ERRLOG("aborting outstanding command\n");
}
nvme_pcie_qpair_manual_complete_tracker(qpair, tr, SPDK_NVME_SCT_GENERIC,
SPDK_NVME_SC_ABORTED_BY_REQUEST, dnr, true);
}

View File

@ -377,7 +377,7 @@ nvme_qpair_manual_complete_request(struct spdk_nvme_qpair *qpair,
error = spdk_nvme_cpl_is_error(&cpl);
if (error && print_on_error) {
if (error && print_on_error && !qpair->ctrlr->opts.disable_error_logging) {
SPDK_NOTICELOG("Command completed manually:\n");
nvme_qpair_print_command(qpair, &req->cmd);
nvme_qpair_print_completion(qpair, &cpl);
@ -395,7 +395,9 @@ nvme_qpair_abort_queued_reqs(struct spdk_nvme_qpair *qpair, uint32_t dnr)
while (!STAILQ_EMPTY(&qpair->queued_req)) {
req = STAILQ_FIRST(&qpair->queued_req);
STAILQ_REMOVE_HEAD(&qpair->queued_req, stailq);
if (!qpair->ctrlr->opts.disable_error_logging) {
SPDK_ERRLOG("aborting queued i/o\n");
}
nvme_qpair_manual_complete_request(qpair, req, SPDK_NVME_SCT_GENERIC,
SPDK_NVME_SC_ABORTED_BY_REQUEST, dnr, true);
}