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 V6 1/1] nvme: Add verbose error logging
Date: Wed, 2 Feb 2022 14:55:56 +0100 [thread overview]
Message-ID: <20220202135556.GA23889@lst.de> (raw)
In-Reply-To: <20220202005050.69289-2-alan.adamson@oracle.com>
On Tue, Feb 01, 2022 at 04:50:50PM -0800, Alan Adamson wrote:
> +nvme-core-y := core.o ioctl.o errors.o
I still don't like the errors.c/o name. This isn't really about
errors per se, but about pretty printing protocol constants. I think
I suggested pretty_print.c before, but maybe just following drivers/scsi/
and calling this constants.c might be best.
> + const unsigned char *op_str = "I/O Cmd";
> + const unsigned char *admin_op_str = "Admin Cmd";
No nee for these constants, just put this into the main format string.
> + const unsigned char *err_str = NULL;
> +
> + err_str = nvme_get_error_status_str(nr->status);
> +
> + if (ns) {
> + op_str = nvme_get_opcode_str(nr->cmd->common.opcode);
And not real need for err_str and op_str either, just put the calls
into the argument list of the pr_err_ratelimited calls.
Also please mark nvme_log_err static and move it so that there is no
need for a forward declaration.
> +const unsigned char *nvme_get_error_status_str(u16 status)
> +{
> + const unsigned char *err_str;
> +
> + if ((status & 0x7ff) < ARRAY_SIZE(nvme_statuses) &&
> + nvme_statuses[status & 0x7ff] != NULL)
> + err_str = nvme_statuses[status & 0x7ff];
> + else
> + err_str = "Unknown";
This can be simplified to:
status &= 0x7ff;
if (status < ARRAY_SIZE(nvme_statuses) nvme_statuses[status])
return nvme_statuses[status];
return "Unknown";
Similar for the other helpers.
> +EXPORT_SYMBOL_GPL(nvme_get_error_status_str);
No need to export any of the function added in this patch, as they are
all used only inside of nvme-core.ko
prev parent reply other threads:[~2022-02-02 14:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 0:50 [PATCH V6 0/1] nvme: Add verbose error logging Alan Adamson
2022-02-02 0:50 ` [PATCH V6 1/1] " Alan Adamson
2022-02-02 8:31 ` Chaitanya Kulkarni
2022-02-02 13:55 ` 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=20220202135556.GA23889@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.