From: Christoph Hellwig <hch@lst.de>
To: Alan Adamson <alan.adamson@oracle.com>
Cc: linux-nvme@lists.infradead.org, kbusch@kernel.org, hch@lst.de,
sagi@grimberg.me
Subject: Re: [PATCH V5 1/1] nvme: Add verbose error logging
Date: Wed, 26 Jan 2022 20:35:35 +0100 [thread overview]
Message-ID: <20220126193535.GA2011@lst.de> (raw)
In-Reply-To: <20220126183313.85877-2-alan.adamson@oracle.com>
On Wed, Jan 26, 2022 at 10:33:13AM -0800, Alan Adamson wrote:
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -354,6 +354,9 @@ void nvme_complete_rq(struct request *req)
>
> switch (nvme_decide_disposition(req)) {
> case COMPLETE:
> + if (unlikely(nvme_req(req)->status != NVME_SC_SUCCESS))
> + nvme_error_log(req);
nvme_log_error would seem a more natural name.
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * NVM Express device driver verbose errors
> + * Copyright (c) 2021, Oracle and/or its affiliates
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + */
No more new license boilerplates, please. That's what we have the
SPDX tag for.
> + [nvme_cmd_dsm] = "Deallocate (DSM)",
This should be "Dataset Management" as in the spec.
> + if (ns) {
> +#ifdef CONFIG_NVME_VERBOSE_ERRORS
> + if (nr->cmd->common.opcode < ARRAY_SIZE(nvme_ops) &&
> + nvme_ops[nr->cmd->common.opcode] != NULL)
> + op_str = nvme_ops[nr->cmd->common.opcode];
> + else
> + op_str = "Unknown";
> +#endif
> + } else {
> +#ifdef CONFIG_NVME_VERBOSE_ERRORS
> + if (nr->cmd->common.opcode < ARRAY_SIZE(nvme_admin_ops) &&
> + nvme_admin_ops[nr->cmd->common.opcode] != NULL)
> + admin_op_str = nvme_admin_ops[nr->cmd->common.opcode];
> + else
> + admin_op_str = "Unknown";
> +#endif
Can't we factor the ifdefs bits of code into little helpers that are
stubbed out if CONFIG_NVME_VERBOSE_ERRORS is not set? That way the main
logging helper could stay in core.c, and we could have a pretty_print.c
with just the constants and these helpers.
> +extern void nvme_error_log(struct request *req);
No need for the extern.
prev parent reply other threads:[~2022-01-26 19:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 18:33 [PATCH V5 0/1] nvme: Add verbose error logging Alan Adamson
2022-01-26 18:33 ` [PATCH V5 1/1] " Alan Adamson
2022-01-26 19:35 ` Christoph Hellwig [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220126193535.GA2011@lst.de \
--to=hch@lst.de \
--cc=alan.adamson@oracle.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.