We can do the accounting between make_request and io is finished, also introduce start_time accordingly. Signed-off-by: Guoqing Jiang <jiangguoqing@xxxxxxxxxx> --- drivers/md/md-multipath.c | 5 +++++ drivers/md/md-multipath.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/md/md-multipath.c b/drivers/md/md-multipath.c index 776bbe542db5..17cf35f4acdb 100644 --- a/drivers/md/md-multipath.c +++ b/drivers/md/md-multipath.c @@ -71,6 +71,8 @@ static void multipath_end_bh_io(struct multipath_bh *mp_bh, blk_status_t status) struct mpconf *conf = mp_bh->mddev->private; bio->bi_status = status; + if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue)) + bio_end_io_acct_remapped(bio, mp_bh->start_time, bio->bi_bdev); bio_endio(bio); mempool_free(mp_bh, &conf->pool); } @@ -124,6 +126,9 @@ static bool multipath_make_request(struct mddev *mddev, struct bio * bio) bio_init(&mp_bh->bio, NULL, 0); __bio_clone_fast(&mp_bh->bio, bio); + if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue)) + mp_bh->start_time = bio_start_io_acct(bio); + mp_bh->bio.bi_iter.bi_sector += multipath->rdev->data_offset; bio_set_dev(&mp_bh->bio, multipath->rdev->bdev); mp_bh->bio.bi_opf |= REQ_FAILFAST_TRANSPORT; diff --git a/drivers/md/md-multipath.h b/drivers/md/md-multipath.h index b3099e5fc4d7..71376d95eac0 100644 --- a/drivers/md/md-multipath.h +++ b/drivers/md/md-multipath.h @@ -28,5 +28,6 @@ struct multipath_bh { struct bio bio; int path; struct list_head retry_list; + unsigned long start_time; }; #endif -- 2.25.1