On 5/18/21 9:40 PM, Christoph Hellwig wrote:
On Tue, May 18, 2021 at 01:32:24PM +0800, Guoqing Jiang wrote:
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 <jiangguoqing@xxxxxxxxxx>
---
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.
Sure.
+ /*
+ * 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.
Ok.
Thanks,
Guoqing