Thread (20 messages) flat view 20 messages, 4 authors, 2021-05-20
STALE1952d

Revision v1 of 4 in this series.

Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v2 [diff vs current]
  4. v3 [diff vs current]

[PATCH 3/5] md-multipath: enable io accounting

From: Guoqing Jiang <hidden>
Date: 2021-05-18 05:33:11
Subsystem: software raid (multiple disks) support, the rest · Maintainers: Song Liu, Yu Kuai, Linus Torvalds

We can do the accounting between make_request and io is finished, also
introduce start_time accordingly.

Signed-off-by: Guoqing Jiang <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help