Re: [PATCH] nvme: add crd value to output error log

Sagi Grimberg <[email protected]>
Newsgroups org.infradead.lists.linux-nvme
Message-ID <[email protected]>
This makes sense to me.

On 09/08/2026 20:34, Tokunori Ikegami wrote:
> Also add NVME_CRD to get the status CRD value.
>
> Signed-off-by: Tokunori Ikegami <[email protected]>
> ---
>   drivers/nvme/host/core.c | 15 +++++++++------
>   include/linux/nvme.h     |  1 +
>   2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 453c1f0b2dd0..0178de333ceb 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -326,7 +326,7 @@ static void nvme_retry_req(struct request *req)
>   	struct nvme_ns *ns = req->q->queuedata;
>   
>   	/* The mask and shift result must be <= 3 */
> -	crd = (nvme_req(req)->status & NVME_STATUS_CRD) >> 11;
> +	crd = NVME_CRD(nvme_req(req)->status);
>   	if (crd)
>   		delay = nvme_req(req)->ctrl->crdt[crd - 1] * 100;
>   
> @@ -344,7 +344,7 @@ static void nvme_log_error(struct request *req)
>   	struct nvme_request *nr = nvme_req(req);
>   
>   	if (ns) {
> -		pr_err_ratelimited("%s: %s(0x%x) @ LBA %llu, %u blocks, %s (sct 0x%x / sc 0x%x) %s%s\n",
> +		pr_err_ratelimited("%s: %s(0x%x) @ LBA %llu, %u blocks, %s (sct 0x%x / sc 0x%x) %s%scrd=%u\n",
>   		       ns->disk ? ns->disk->disk_name : "?",
>   		       nvme_get_opcode_str(nr->cmd->common.opcode),
>   		       nr->cmd->common.opcode,
> @@ -354,11 +354,12 @@ static void nvme_log_error(struct request *req)
>   		       NVME_SCT(nr->status),		/* Status Code Type */
>   		       nr->status & NVME_SC_MASK,	/* Status Code */
>   		       nr->status & NVME_STATUS_MORE ? "MORE " : "",
> -		       nr->status & NVME_STATUS_DNR  ? "DNR "  : "");
> +		       nr->status & NVME_STATUS_DNR  ? "DNR "  : "",
> +		       NVME_CRD(nr->status));
>   		return;
>   	}
>   
> -	pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%s\n",
> +	pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%scrd=%u\n",

no space? also perhaps "crd 0x%x" ?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.