[PATCHv3 02/10] block: provide helper for nr_integrity_segments
Keith Busch
kbusch at meta.com
Wed Sep 4 08:25:57 PDT 2024
From: Keith Busch <kbusch at kernel.org>
This way drivers that want this value don't need to concern themselves
with the CONFIG_BLK_DEV_INTEGRITY setting.
Signed-off-by: Keith Busch <kbusch at kernel.org>
---
include/linux/blk-mq.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 8d304b1d16b15..3984aad9bf64a 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -228,6 +228,18 @@ static inline unsigned short req_get_ioprio(struct request *req)
return req->ioprio;
}
+#ifdef CONFIG_BLK_DEV_INTEGRITY
+static inline unsigned short blk_rq_integrity_segments(struct request *rq)
+{
+ return rq->nr_integrity_segments;
+}
+#else
+static inline unsigned short blk_rq_integrity_segments(struct request *rq)
+{
+ return 0;
+}
+#endif
+
#define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ)
#define rq_dma_dir(rq) \
--
2.43.5
More information about the Linux-nvme
mailing list