[dm-devel] [PATCH 5/5] block: pass the start sector to get_max_io_size

Christoph Hellwig hch at lst.de
Tue Oct 12 16:36:13 UTC 2021


Pass the start sector instead of the whole bio.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 block/blk-merge.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 15b2aef1507e5..b397972b526a0 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -174,12 +174,10 @@ static struct bio *blk_bio_write_same_split(struct request_queue *q,
  * requests that are submitted to a block device if the start of a bio is not
  * aligned to a physical block boundary.
  */
-static inline unsigned get_max_io_size(struct request_queue *q,
-				       struct bio *bio)
+static inline unsigned get_max_io_size(struct request_queue *q, sector_t sector)
 {
 	unsigned pbs = queue_physical_block_size(q) >> SECTOR_SHIFT;
 	unsigned lbs = queue_logical_block_size(q) >> SECTOR_SHIFT;
-	sector_t sector = bio->bi_iter.bi_sector;
 	unsigned start_offset = sector & (pbs - 1);
 	unsigned sectors = q->limits.max_sectors;
 	unsigned max_sectors;
@@ -287,7 +285,7 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
 	struct bio_vec bv, bvprv, *bvprvp = NULL;
 	struct bvec_iter iter;
 	unsigned nsegs = 0, sectors = 0;
-	const unsigned max_sectors = get_max_io_size(q, bio);
+	const unsigned max_sectors = get_max_io_size(q, bio->bi_iter.bi_sector);
 	const unsigned max_segs = queue_max_segments(q);
 
 	bio_for_each_bvec(bv, bio, iter) {
-- 
2.30.2




More information about the dm-devel mailing list