]> www.infradead.org Git - users/hch/block.git/commitdiff
block: pass the start sector to get_max_io_size get_max_io_size
authorChristoph Hellwig <hch@lst.de>
Fri, 10 Sep 2021 11:50:50 +0000 (13:50 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 28 Sep 2021 05:44:36 +0000 (07:44 +0200)
Pass the start sector instead of the whole bio.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/blk-merge.c

index e3ed935e37cf8a49a949d43f279c64afe4e30617..b1cc6f392ad68effedeb0ff5ea56b5b87e3db1b6 100644 (file)
@@ -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) {