Skip to content

Commit 528bc2c

Browse files
GuoqingJiang-Linuxliu-song-6
authored andcommitted
md/raid10: enable io accounting
For raid10, we record the start time between split bio and clone bio, and finish the accounting in the final endio. Also introduce start_time in r10bio accordingly. Signed-off-by: Guoqing Jiang <[email protected]> Signed-off-by: Song Liu <[email protected]>
1 parent a015983 commit 528bc2c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/md/raid10.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ static void raid_end_bio_io(struct r10bio *r10_bio)
297297
if (!test_bit(R10BIO_Uptodate, &r10_bio->state))
298298
bio->bi_status = BLK_STS_IOERR;
299299

300+
if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
301+
bio_end_io_acct(bio, r10_bio->start_time);
300302
bio_endio(bio);
301303
/*
302304
* Wake up any possible resync thread that waits for the device
@@ -1184,6 +1186,8 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
11841186
}
11851187
slot = r10_bio->read_slot;
11861188

1189+
if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
1190+
r10_bio->start_time = bio_start_io_acct(bio);
11871191
read_bio = bio_clone_fast(bio, gfp, &mddev->bio_set);
11881192

11891193
r10_bio->devs[slot].bio = read_bio;
@@ -1483,6 +1487,8 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio,
14831487
r10_bio->master_bio = bio;
14841488
}
14851489

1490+
if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
1491+
r10_bio->start_time = bio_start_io_acct(bio);
14861492
atomic_set(&r10_bio->remaining, 1);
14871493
md_bitmap_startwrite(mddev->bitmap, r10_bio->sector, r10_bio->sectors, 0);
14881494

drivers/md/raid10.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ struct r10bio {
124124
sector_t sector; /* virtual sector number */
125125
int sectors;
126126
unsigned long state;
127+
unsigned long start_time;
127128
struct mddev *mddev;
128129
/*
129130
* original bio going to /dev/mdx

0 commit comments

Comments
 (0)