* [PATCH v2] nvme: check PI size if metadata size or below
@ 2024-10-22 16:54 Tokunori Ikegami
0 siblings, 0 replies; only message in thread
From: Tokunori Ikegami @ 2024-10-22 16:54 UTC (permalink / raw)
To: linux-nvme; +Cc: Tokunori Ikegami
The PI is the first bytes or last bytes of the metadata.
So its size is not equal to the metadata size only but below also.
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
---
Changes since v1:
- Fix the commit message spelling miss hte to the.
drivers/nvme/host/ioctl.c | 4 ++--
drivers/nvme/host/nvme.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index b9b79ccfabf8..9fddaaddbbf1 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -232,8 +232,8 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
length = (io.nblocks + 1) << ns->head->lba_shift;
- 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;
}
struct nvme_ctrl_ops {
--
2.45.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-10-22 17:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22 16:54 [PATCH v2] nvme: check PI size if metadata size or below Tokunori Ikegami
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox