Skip to content

Commit ee9f36d

Browse files
MatiasBjorlingkeithbusch
authored andcommitted
nvme: use command set independent id ns if available
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 <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent e2758c7 commit ee9f36d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/nvme/host/core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3988,7 +3988,7 @@ static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid)
39883988
{
39893989
struct nvme_ns_info info = { .nsid = nsid };
39903990
struct nvme_ns *ns;
3991-
int ret;
3991+
int ret = 1;
39923992

39933993
if (nvme_identify_ns_descs(ctrl, &info))
39943994
return;
@@ -4005,9 +4005,10 @@ static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid)
40054005
* set up a namespace. If not fall back to the legacy version.
40064006
*/
40074007
if ((ctrl->cap & NVME_CAP_CRMS_CRIMS) ||
4008-
(info.ids.csi != NVME_CSI_NVM && info.ids.csi != NVME_CSI_ZNS))
4008+
(info.ids.csi != NVME_CSI_NVM && info.ids.csi != NVME_CSI_ZNS) ||
4009+
ctrl->vs >= NVME_VS(2, 0, 0))
40094010
ret = nvme_ns_info_from_id_cs_indep(ctrl, &info);
4010-
else
4011+
if (ret > 0)
40114012
ret = nvme_ns_info_from_identify(ctrl, &info);
40124013

40134014
if (info.is_removed)

0 commit comments

Comments
 (0)