* [PATCH] nvme-fc: add DIF support for intergrity metadata
@ 2024-12-26 9:14 Atharva Tiwari
2025-01-03 6:57 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Atharva Tiwari @ 2024-12-26 9:14 UTC (permalink / raw)
Cc: evepolonium, James Smart, Keith Busch, Jens Axboe,
Christoph Hellwig, Sagi Grimberg, linux-nvme, linux-kernel
This patch enhances the NVMe over Fibre Channel (NVMe-FC) driver to
handle requests with integrity metadata (DIF).
- Added the inclusion of `<linux/blk-integrity.h>` to enable integrity operations.
- Implemented support for mapping integrity metadata using `blk_rq_map_integrity_sg`.
- Ensures proper handling of requests with integrity metadata, including error cases where mapping fails.
This update improves the reliability of data integrity checks in environments utilizing DIF.
Signed-off-by: Atharva Tiwari <evepolonium@gmail.com>
---
drivers/nvme/host/fc.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index b81af7919e94..d0343133413f 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -17,6 +17,7 @@
#include "fc.h"
#include <scsi/scsi_transport_fc.h>
#include <linux/blk-mq-pci.h>
+#include <linux/blk-integrity.h>
/* *************************** Data Structures/Defines ****************** */
@@ -2620,10 +2621,16 @@ nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq,
freq->sg_cnt = 0;
return -EFAULT;
}
-
- /*
- * TODO: blk_integrity_rq(rq) for DIF
- */
+ /* Handle requests with integrity metadata (DIF) */
+ if (blk_integrity_rq(rq)) {
+ ret = blk_rq_map_integrity_sg(rq, freq->sg_table.sgl);
+ if (ret < 0) {
+ sg_free_table_chained(&freq->sg_table, NVME_INLINE_SG_CNT);
+ freq->sg_cnt = 0;
+ return -EFAULT;
+ }
+ freq->sg_cnt += ret;
+ }
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] nvme-fc: add DIF support for intergrity metadata
@ 2024-12-27 4:27 Atharva Tiwari
0 siblings, 0 replies; 3+ messages in thread
From: Atharva Tiwari @ 2024-12-27 4:27 UTC (permalink / raw)
Cc: evepolonium, James Smart, Keith Busch, Jens Axboe,
Christoph Hellwig, Sagi Grimberg, linux-nvme, linux-kernel
This patch enhances the NVMe over Fibre Channel (NVMe-FC) driver to
handle requests with integrity metadata (DIF).
- Added the inclusion of `<linux/blk-integrity.h>` to enable integrity operations.
- Implemented support for mapping integrity metadata using `blk_rq_map_integrity_sg`.
- Ensures proper handling of requests with integrity metadata, including error cases where mapping fails.
This update improves the reliability of data integrity checks in environments utilizing DIF.
Signed-off-by: Atharva Tiwari <evepolonium@gmail.com>
---
drivers/nvme/host/fc.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index b81af7919e94..d0343133413f 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -17,6 +17,7 @@
#include "fc.h"
#include <scsi/scsi_transport_fc.h>
#include <linux/blk-mq-pci.h>
+#include <linux/blk-integrity.h>
/* *************************** Data Structures/Defines ****************** */
@@ -2620,10 +2621,16 @@ nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq,
freq->sg_cnt = 0;
return -EFAULT;
}
-
- /*
- * TODO: blk_integrity_rq(rq) for DIF
- */
+ /* Handle requests with integrity metadata (DIF) */
+ if (blk_integrity_rq(rq)) {
+ ret = blk_rq_map_integrity_sg(rq, freq->sg_table.sgl);
+ if (ret < 0) {
+ sg_free_table_chained(&freq->sg_table, NVME_INLINE_SG_CNT);
+ freq->sg_cnt = 0;
+ return -EFAULT;
+ }
+ freq->sg_cnt += ret;
+ }
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-fc: add DIF support for intergrity metadata
2024-12-26 9:14 [PATCH] nvme-fc: add DIF support for intergrity metadata Atharva Tiwari
@ 2025-01-03 6:57 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2025-01-03 6:57 UTC (permalink / raw)
To: Atharva Tiwari
Cc: James Smart, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, linux-nvme, linux-kernel
On Thu, Dec 26, 2024 at 02:44:15PM +0530, Atharva Tiwari wrote:
> This patch enhances the NVMe over Fibre Channel (NVMe-FC) driver to
> handle requests with integrity metadata (DIF).
>
> - Added the inclusion of `<linux/blk-integrity.h>` to enable integrity operations.
> - Implemented support for mapping integrity metadata using `blk_rq_map_integrity_sg`.
> - Ensures proper handling of requests with integrity metadata, including error cases where mapping fails.
This isn't really how we write commit logs. The mechanics are
visible in the patch. Also please wrap commit log lines after 73
characters.
> + /* Handle requests with integrity metadata (DIF) */
> + if (blk_integrity_rq(rq)) {
> + ret = blk_rq_map_integrity_sg(rq, freq->sg_table.sgl);
> + if (ret < 0) {
> + sg_free_table_chained(&freq->sg_table, NVME_INLINE_SG_CNT);
> + freq->sg_cnt = 0;
> + return -EFAULT;
> + }
> + freq->sg_cnt += ret;
> + }
Who is going to look at the integrity sglist? Who is setting a
max_integrity_segments value for nvme-fc?
How was this tested?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-03 6:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-26 9:14 [PATCH] nvme-fc: add DIF support for intergrity metadata Atharva Tiwari
2025-01-03 6:57 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2024-12-27 4:27 Atharva Tiwari
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox