From: Christoph Hellwig Date: Fri, 10 Sep 2021 11:50:50 +0000 (+0200) Subject: block: pass the start sector to get_max_io_size X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fget_max_io_size;p=users%2Fhch%2Fblock.git block: pass the start sector to get_max_io_size Pass the start sector instead of the whole bio. Signed-off-by: Christoph Hellwig --- diff --git a/block/blk-merge.c b/block/blk-merge.c index e3ed935e37cf..b1cc6f392ad6 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -142,12 +142,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; @@ -255,7 +253,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) {