Fold blk_max_size_offset into the only remaining user. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- block/blk-merge.c | 14 +++++++++----- include/linux/blkdev.h | 19 ------------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index b3da43160032f..15b2aef1507e5 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -177,14 +177,18 @@ static struct bio *blk_bio_write_same_split(struct request_queue *q, static inline unsigned get_max_io_size(struct request_queue *q, struct bio *bio) { - unsigned sectors = blk_max_size_offset(q, bio->bi_iter.bi_sector, 0); - unsigned max_sectors = sectors; unsigned pbs = queue_physical_block_size(q) >> SECTOR_SHIFT; unsigned lbs = queue_logical_block_size(q) >> SECTOR_SHIFT; - unsigned start_offset = bio->bi_iter.bi_sector & (pbs - 1); + sector_t sector = bio->bi_iter.bi_sector; + unsigned start_offset = sector & (pbs - 1); + unsigned sectors = q->limits.max_sectors; + unsigned max_sectors; - max_sectors += start_offset; - max_sectors &= ~(pbs - 1); + if (q->limits.chunk_sectors) + sectors = min(chunk_size_left(sector, q->limits.chunk_sectors), + sectors); + + max_sectors = (sectors + start_offset) & ~(pbs - 1); if (max_sectors > start_offset) return max_sectors - start_offset; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0b020bb45a3e7..c2fa4666f25e3 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -634,25 +634,6 @@ static inline unsigned int chunk_size_left(sector_t offset, return chunk_sectors - (offset & (chunk_sectors - 1)); } -/* - * Return maximum size of a request at given offset. Only valid for - * file system requests. - */ -static inline unsigned int blk_max_size_offset(struct request_queue *q, - sector_t offset, - unsigned int chunk_sectors) -{ - if (!chunk_sectors) { - if (q->limits.chunk_sectors) - chunk_sectors = q->limits.chunk_sectors; - else - return q->limits.max_sectors; - } - - return min(q->limits.max_sectors, - chunk_size_left(offset, chunk_sectors)); -} - /* * Access functions for manipulating queue properties */ -- 2.30.2 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel