[RFC PATCH v1 17/18] block: export helper to get segment max size
Leon Romanovsky
leon at kernel.org
Tue Jul 2 02:09:47 PDT 2024
From: Chaitanya Kulkarni <kch at nvidia.com>
Export the get_max_segment_size() so driver can do use that to create
DMA mapping when it receives the request.
Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
Signed-off-by: Leon Romanovsky <leonro at nvidia.com>
---
block/blk-merge.c | 3 ++-
include/linux/blk-mq.h | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 8534c35e0497..0561e728ef95 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -190,7 +190,7 @@ static inline unsigned get_max_io_size(struct bio *bio,
*
* Returns the maximum number of bytes that can be added as a single segment.
*/
-static inline unsigned get_max_segment_size(const struct queue_limits *lim,
+inline unsigned get_max_segment_size(const struct queue_limits *lim,
struct page *start_page, unsigned long offset)
{
unsigned long mask = lim->seg_boundary_mask;
@@ -203,6 +203,7 @@ static inline unsigned get_max_segment_size(const struct queue_limits *lim,
*/
return min(mask - offset, (unsigned long)lim->max_segment_size - 1) + 1;
}
+EXPORT_SYMBOL_GPL(get_max_segment_size);
/**
* bvec_split_segs - verify whether or not a bvec should be split in the middle
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 89ba6b16fe8b..008c77c9b518 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -1150,4 +1150,7 @@ static inline int blk_rq_map_sg(struct request_queue *q, struct request *rq,
}
void blk_dump_rq_flags(struct request *, char *);
+unsigned get_max_segment_size(const struct queue_limits *lim,
+ struct page *start_page, unsigned long offset);
+
#endif /* BLK_MQ_H */
--
2.45.2
More information about the Linux-nvme
mailing list