summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-06-14 11:09:30 +0200
committerJens Axboe <axboe@kernel.dk>2022-06-27 14:29:11 +0200
commitc39493222e41098cd15d11f972d16e943919506d (patch)
tree6651b2dc778ac1d9093a22b93e10af38a10c35b9 /drivers/md/dm.c
parentblock: factor out a chunk_size_left helper (diff)
downloadlinux-c39493222e41098cd15d11f972d16e943919506d.tar.xz
linux-c39493222e41098cd15d11f972d16e943919506d.zip
dm: open code blk_max_size_offset in max_io_len
max_io_len always passes an explicitly non-zero chunk_sectors into blk_max_size_offset. That means much of blk_max_size_offset is not needed and can be open coded to simplify the code. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Snitzer <snitzer@kernel.org> Link: https://lore.kernel.org/r/20220614090934.570632-3-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r--drivers/md/dm.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 2b75f1ef7386..4c04a980fcd9 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1086,23 +1086,18 @@ static sector_t max_io_len(struct dm_target *ti, sector_t sector)
{
sector_t target_offset = dm_target_offset(ti, sector);
sector_t len = max_io_len_target_boundary(ti, target_offset);
- sector_t max_len;
/*
* Does the target need to split IO even further?
* - varied (per target) IO splitting is a tenet of DM; this
* explains why stacked chunk_sectors based splitting via
- * blk_max_size_offset() isn't possible here. So pass in
- * ti->max_io_len to override stacked chunk_sectors.
+ * blk_queue_split() isn't possible here.
*/
- if (ti->max_io_len) {
- max_len = blk_max_size_offset(ti->table->md->queue,
- target_offset, ti->max_io_len);
- if (len > max_len)
- len = max_len;
- }
-
- return len;
+ if (!ti->max_io_len)
+ return len;
+ return min_t(sector_t, len,
+ min(queue_max_sectors(ti->table->md->queue),
+ blk_chunk_sectors_left(target_offset, ti->max_io_len)));
}
int dm_set_target_max_io_len(struct dm_target *ti, sector_t len)