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

Re: [PATCH 4/5] md/raid1: enable io accounting

From: Christoph Hellwig <hch@infradead.org>
Date: 2021-05-18 13:42:25

On Tue, May 18, 2021 at 01:32:24PM +0800, Guoqing Jiang wrote:
quoted hunk ↗ jump to hunk
For raid1, we record the start time between split bio and clone bio,
and finish the accounting in the final endio.

Also introduce start_time in r1bio accordingly.

Signed-off-by: Guoqing Jiang <redacted>
---
 drivers/md/raid1.c | 11 +++++++++++
 drivers/md/raid1.h |  1 +
 2 files changed, 12 insertions(+)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ced076ba560e..b08a47523dbb 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -300,6 +300,8 @@ static void call_bio_endio(struct r1bio *r1_bio)
 	if (!test_bit(R1BIO_Uptodate, &r1_bio->state))
 		bio->bi_status = BLK_STS_IOERR;
 
+	if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
+		bio_end_io_acct_remapped(bio, r1_bio->start_time, bio->bi_bdev);
This can use bio_end_io_acct.
+	/*
+	 * Reuse print_msg, if it is false then a fresh r1_bio is just
+	 * allocated before.
+	 */
+	if (!print_msg && blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
+		r1_bio->start_time = bio_start_io_acct(bio);
+
Please rename the print_msg vaiable to something sensible and drop the
comment.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help