Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: use ns->head->pi_size instead of t10_pi_tuple structure size
       [not found] <CGME20240207050232epcas5p4f6fcd56e72f6b25fe44123df4597a770@epcas5p4.samsung.com>
@ 2024-02-06 23:34 ` francis.p
  2024-02-07 23:57   ` Keith Busch
  0 siblings, 1 reply; 2+ messages in thread
From: francis.p @ 2024-02-06 23:34 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi
  Cc: linux-nvme, sathya.m, d.palani, prakash.bv, anshul,
	Francis Pravin

From: Francis Pravin <francis.p@samsung.com>

Currently kernel supports 8 byte and 16 byte protection information.
So, use ns->head->pi_size instead of sizeof(struct t10_pi_tuple).

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Signed-off-by: Sathyavathi M <sathya.m@samsung.com>
---
 drivers/nvme/host/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index 18f5c1be..3dfd5ae9 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -228,7 +228,7 @@ 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 == sizeof(struct t10_pi_tuple)) {
+	    (ns->head->ms == ns->head->pi_size)) {
 		/*
 		 * Protection information is stripped/inserted by the
 		 * controller.
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nvme: use ns->head->pi_size instead of t10_pi_tuple structure size
  2024-02-06 23:34 ` [PATCH] nvme: use ns->head->pi_size instead of t10_pi_tuple structure size francis.p
@ 2024-02-07 23:57   ` Keith Busch
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Busch @ 2024-02-07 23:57 UTC (permalink / raw)
  To: francis.p
  Cc: axboe, hch, sagi, linux-nvme, sathya.m, d.palani, prakash.bv,
	anshul

On Wed, Feb 07, 2024 at 05:04:17AM +0530, francis.p@samsung.com wrote:
> @@ -228,7 +228,7 @@ 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 == sizeof(struct t10_pi_tuple)) {
> +	    (ns->head->ms == ns->head->pi_size)) {

We could use 'nvme_ns_has_pi(ns->head)' instead. It's essentially the
same as this, so patch applied. Thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-07 23:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20240207050232epcas5p4f6fcd56e72f6b25fe44123df4597a770@epcas5p4.samsung.com>
2024-02-06 23:34 ` [PATCH] nvme: use ns->head->pi_size instead of t10_pi_tuple structure size francis.p
2024-02-07 23:57   ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox