Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Matias Bjørling" <m@bjorling.me>
To: kbusch@kernel.org, hch@lst.de, dlemoal@kernel.org,
	cassel@kernel.org, linux-nvme@lists.infradead.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Matias Bjørling" <matias.bjorling@wdc.com>
Subject: [PATCH 1/2] nvme: make independent ns identify default
Date: Tue,  8 Oct 2024 16:55:02 +0200	[thread overview]
Message-ID: <20241008145503.987195-2-m@bjorling.me> (raw)
In-Reply-To: <20241008145503.987195-1-m@bjorling.me>

From: Matias Bjørling <matias.bjorling@wdc.com>

The NVMe 2.0 specification adds an independent identify namespace
data structure that contains generic attributes that apply to all
namespace types. Some attributes carry over from the NVM command set
identify namespace data structure, and others are new.

Currently, the data structure only considered when CRIMS is enabled or
when the namespace type is key-value.

However, the independent namespace data structure
is mandatory for devices that implement features from the 2.0+
specification. Therefore, we can check this data structure first. If
unavailable, retrieve the generic attributes from the NVM command set
identify namespace data structure.

Signed-off-by: Matias Bjørling <matias.bjorling@wdc.com>
---
 drivers/nvme/host/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 0dc8bcc664f2..9cbef6342c39 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3999,7 +3999,7 @@ static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid)
 {
 	struct nvme_ns_info info = { .nsid = nsid };
 	struct nvme_ns *ns;
-	int ret;
+	int ret = 1;
 
 	if (nvme_identify_ns_descs(ctrl, &info))
 		return;
@@ -4015,10 +4015,9 @@ static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid)
 	 * data structure to find all the generic information that is needed to
 	 * set up a namespace.  If not fall back to the legacy version.
 	 */
-	if ((ctrl->cap & NVME_CAP_CRMS_CRIMS) ||
-	    (info.ids.csi != NVME_CSI_NVM && info.ids.csi != NVME_CSI_ZNS))
+	if (!nvme_ctrl_limited_cns(ctrl))
 		ret = nvme_ns_info_from_id_cs_indep(ctrl, &info);
-	else
+	if (ret > 0)
 		ret = nvme_ns_info_from_identify(ctrl, &info);
 
 	if (info.is_removed)
-- 
2.46.0



  reply	other threads:[~2024-10-08 14:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08 14:55 [PATCH 0/2] nvme: add rotational support Matias Bjørling
2024-10-08 14:55 ` Matias Bjørling [this message]
2024-10-09  6:16   ` [PATCH 1/2] nvme: make independent ns identify default Hannes Reinecke
2024-10-09 13:59     ` Matias Bjørling
2024-10-09  7:46   ` Christoph Hellwig
2024-10-09 13:19     ` Matias Bjørling
2024-10-10 14:47       ` Daniel Wagner
2024-10-10 15:02         ` Matias Bjørling
2024-10-09 14:56     ` Keith Busch
2024-10-10  7:53       ` Christoph Hellwig
2024-10-08 14:55 ` [PATCH 2/2] nvme: add rotational support Matias Bjørling
2024-10-09  6:17   ` Hannes Reinecke
2024-10-09  7:48   ` Christoph Hellwig
2024-10-09 13:09     ` Matias Bjørling
2024-10-08 15:13 ` [PATCH 0/2] " Keith Busch
2024-10-08 22:04   ` Keith Busch
2024-10-09 12:56     ` Matias Bjørling
2024-10-08 15:26 ` Martin K. Petersen
2024-10-09  7:43 ` Christoph Hellwig
2024-10-09 13:27   ` Matias Bjørling
2024-10-09 15:39   ` Keith Busch
2024-10-09 18:04     ` Matias Bjørling

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=20241008145503.987195-2-m@bjorling.me \
    --to=m@bjorling.me \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=matias.bjorling@wdc.com \
    /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