aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-01-24 11:02:38 +0100
committerJens Axboe <axboe@kernel.dk>2021-01-24 18:17:20 -0700
commit0b6e522cdc4a76352e5f02fc2d92198f03254425 (patch)
tree97b7452632aa87a60c1b9764938e2b9a23a409f9 /block/blk-core.c
parentblock: use ->bi_bdev for bio based I/O accounting (diff)
downloadlinux-dev-0b6e522cdc4a76352e5f02fc2d92198f03254425.tar.xz
linux-dev-0b6e522cdc4a76352e5f02fc2d92198f03254425.zip
blk-mq: use ->bi_bdev for I/O accounting
Remove the reverse map from a sector to a partition for I/O accounting by simply using ->bi_bdev. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 9315311c27a9..6dfbdde6b9ff 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1298,7 +1298,11 @@ void blk_account_io_start(struct request *rq)
if (!blk_do_io_stat(rq))
return;
- rq->part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));
+ /* passthrough requests can hold bios that do not have ->bi_bdev set */
+ if (rq->bio && rq->bio->bi_bdev)
+ rq->part = rq->bio->bi_bdev;
+ else
+ rq->part = rq->rq_disk->part0;
part_stat_lock();
update_io_ticks(rq->part, jiffies, false);