public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Tokunori Ikegami <ikegami.t@gmail.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme: check PI size if metadata size or below
Date: Tue, 22 Oct 2024 10:54:48 -0600	[thread overview]
Message-ID: <ZxfY2IT15o_2vTZq@kbusch-mbp> (raw)
In-Reply-To: <20241022163504.10738-1-ikegami.t@gmail.com>

On Wed, Oct 23, 2024 at 01:34:27AM +0900, Tokunori Ikegami wrote:
> -	if ((io.control & NVME_RW_PRINFO_PRACT) &&
> -	    (ns->head->ms == ns->head->pi_size)) {
> +	if (io.control & NVME_RW_PRINFO_PRACT &&
> +	    ns->head->ms >= ns->head->pi_size) {
>  		/*
>  		 * Protection information is stripped/inserted by the
>  		 * controller.
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index 093cb423f536..fbcb2243ba84 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -542,7 +542,7 @@ struct nvme_ns {
>  /* NVMe ns supports metadata actions by the controller (generate/strip) */
>  static inline bool nvme_ns_has_pi(struct nvme_ns_head *head)
>  {
> -	return head->pi_type && head->ms == head->pi_size;
> +	return head->pi_type && head->ms >= head->pi_size;
>  }

It would have been nice if PRACT worked this way, but spec says it
doesn't. The control bit is a no-op if Metadata Size does not equal the
PI size, which is what these checks are looking for, so we can't take
this.


  reply	other threads:[~2024-10-22 17:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22 16:34 [PATCH] nvme: check PI size if metadata size or below Tokunori Ikegami
2024-10-22 16:54 ` Keith Busch [this message]
2024-10-22 17:08   ` Tokunori Ikegami
2024-10-22 17:33     ` Keith Busch
2024-10-22 17:51       ` Tokunori Ikegami
2024-10-22 17:57         ` Keith Busch
2024-10-22 18:12           ` Tokunori Ikegami

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=ZxfY2IT15o_2vTZq@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=ikegami.t@gmail.com \
    --cc=linux-nvme@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox