From: Irvin Cote <irvincoteg@gmail.com>
To: hch@lst.de
Cc: kbusch@kernel.org, axboe@kernel.dk, sagi@grimberg.me,
linux-nvme@lists.infradead.org, Irvin Cote <irvincoteg@gmail.com>
Subject: [PATCH] nvme-core: check id->mc before setting NVME_NS_METADATA_SUPPORTED
Date: Sat, 24 Jun 2023 12:35:02 +0200 [thread overview]
Message-ID: <20230624103502.8772-1-irvincoteg@gmail.com> (raw)
The NVM Command set Identify Namespace Data Structure defines
the metadata capabilities field (mc) that determines support for
metadata. Check for the value of this field before enabling the
NVME_NS_METADATA_SUPPORTED in the nvme_ns data structure.
Signed-off-by: Irvin Cote <irvincoteg@gmail.com>
---
drivers/nvme/host/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 3ec38e2b9173..465206b5cf6f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1841,7 +1841,8 @@ static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
* Note, this check will need to be modified if any drivers
* gain the ability to use other metadata formats.
*/
- if (ctrl->max_integrity_segments && nvme_ns_has_pi(ns))
+ if (ctrl->max_integrity_segments && nvme_ns_has_pi(ns)
+ && (id->mc & NVME_MC_EXTENDED_LBA))
ns->features |= NVME_NS_METADATA_SUPPORTED;
} else {
/*
@@ -1852,7 +1853,7 @@ static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
*/
if (id->flbas & NVME_NS_FLBAS_META_EXT)
ns->features |= NVME_NS_EXT_LBAS;
- else
+ else if (id->mc & NVME_MC_METADATA_PTR)
ns->features |= NVME_NS_METADATA_SUPPORTED;
}
}
--
2.40.1
next reply other threads:[~2023-06-24 10:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-24 10:35 Irvin Cote [this message]
2023-06-27 15:30 ` [PATCH] nvme-core: check id->mc before setting NVME_NS_METADATA_SUPPORTED Keith Busch
2023-06-27 16:02 ` Max Gurtovoy
2023-06-30 17:41 ` irvin cote
2023-07-02 14:02 ` irvin cote
2023-07-10 7:01 ` Christoph Hellwig
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=20230624103502.8772-1-irvincoteg@gmail.com \
--to=irvincoteg@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox