[PATCH v3 02/10] block: introduce a helper to determine metadata bytes from data iter
Anuj Gupta
anuj20.g at samsung.com
Fri Aug 23 03:38:02 PDT 2024
Introduce a new helper bio_iter_integrity_bytes to determine the number
of metadata bytes corresponding to data iter.
Suggested-by: Christoph Hellwig <hch at lst.de>
Signed-off-by: Anuj Gupta <anuj20.g at samsung.com>
---
include/linux/blk-integrity.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h
index de98049b7ded..2ff65c933c50 100644
--- a/include/linux/blk-integrity.h
+++ b/include/linux/blk-integrity.h
@@ -76,6 +76,15 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
return bio_integrity_intervals(bi, sectors) * bi->tuple_size;
}
+/*
+ * Return the integrity bytes corresponding to data iter
+ */
+static inline unsigned int bio_iter_integrity_bytes(struct blk_integrity *bi,
+ struct bvec_iter iter)
+{
+ return bio_integrity_bytes(bi, bvec_iter_sectors(iter));
+}
+
static inline bool blk_integrity_rq(struct request *rq)
{
return rq->cmd_flags & REQ_INTEGRITY;
@@ -132,6 +141,13 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
{
return 0;
}
+
+static inline unsigned int bio_iter_integrity_bytes(struct blk_integrity *bi,
+ struct bvec_iter iter)
+{
+ return 0;
+}
+
static inline int blk_integrity_rq(struct request *rq)
{
return 0;
--
2.25.1
More information about the Linux-nvme
mailing list