Re: [PATCH v20 07/12] nvme: add copy offload support

From: Nitesh Shetty
Date: Mon Jun 03 2024 - 07:53:41 EST


On 01/06/24 08:22AM, Christoph Hellwig wrote:
On Mon, May 20, 2024 at 03:50:20PM +0530, Nitesh Shetty wrote:
+ if (blk_rq_nr_phys_segments(req) != BLK_COPY_MAX_SEGMENTS)
+ return BLK_STS_IOERR;

This sounds like BLK_COPY_MAX_SEGMENTS is misnamed. Right now this is
not a max segments, but the exact number of segments required.

We will move this check to block layer, with name
BLK_COPY_TOTAL_SEGMENTS.

/*
* Recommended frequency for KATO commands per NVMe 1.4 section 7.12.1:
- *
+ *

Please submit this whitespace fix separately.

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 8b1edb46880a..1c5974bb23d5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1287,6 +1287,7 @@ static inline unsigned int bdev_discard_granularity(struct block_device *bdev)

/* maximum copy offload length, this is set to 128MB based on current testing */
#define BLK_COPY_MAX_BYTES (1 << 27)
+#define BLK_COPY_MAX_SEGMENTS 2

... and this doesn't belong into a NVMe patch. I'd also expect that
the block layer would verify this before sending of the request to the driver.

Acked

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 425573202295..5275a0962a02 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h

Note that we've usually kept adding new protocol bits to nvme.h separate
from the implementation in the host or target code.

Acked, will move it to a separate patch.

Thank you,
Nitesh Shetty