diff mbox series

[PATCHv4,06/10] block: provide helper for nr_integrity_segments

Message ID 20240911201240.3982856-7-kbusch@meta.com (mailing list archive)
State New, archived
Headers show
Series block integrity merging and counting | expand

Commit Message

Keith Busch Sept. 11, 2024, 8:12 p.m. UTC
From: Keith Busch <kbusch@kernel.org>

Provide an integrity equivalent to blk_rq_nr_phys_segments().

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 include/linux/blk-mq.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Christoph Hellwig Sept. 12, 2024, 7:44 a.m. UTC | #1
On Wed, Sep 11, 2024 at 01:12:36PM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> Provide an integrity equivalent to blk_rq_nr_phys_segments().

Now that the field is unconditional the helper seems a bit pointless.
blk_rq_nr_phys_segments is mostly need for the special payload magic
for discard.
Martin K. Petersen Sept. 13, 2024, 1:52 a.m. UTC | #2
Christoph,

> Now that the field is unconditional the helper seems a bit pointless.

Yeah, maybe. I'm OK either way.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Kanchan Joshi Sept. 13, 2024, 12:35 p.m. UTC | #3
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
diff mbox series

Patch

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 4fecf46ef681b..33557af495100 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -1156,6 +1156,11 @@  static inline unsigned short blk_rq_nr_phys_segments(struct request *rq)
 	return rq->nr_phys_segments;
 }
 
+static inline unsigned short blk_rq_nr_integrity_segments(struct request *rq)
+{
+	return rq->nr_integrity_segments;
+}
+
 /*
  * Number of discard segments (or ranges) the driver needs to fill in.
  * Each discard bio merged into a request is counted as one segment.