forked from Minki/linux
md/raid1: enable io accounting
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@kylinos.cn> Signed-off-by: Song Liu <song@kernel.org>
This commit is contained in:
parent
9b8ae7b938
commit
a0159832e5
@ -300,6 +300,8 @@ static void call_bio_endio(struct r1bio *r1_bio)
|
|||||||
if (!test_bit(R1BIO_Uptodate, &r1_bio->state))
|
if (!test_bit(R1BIO_Uptodate, &r1_bio->state))
|
||||||
bio->bi_status = BLK_STS_IOERR;
|
bio->bi_status = BLK_STS_IOERR;
|
||||||
|
|
||||||
|
if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
|
||||||
|
bio_end_io_acct(bio, r1_bio->start_time);
|
||||||
bio_endio(bio);
|
bio_endio(bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1292,6 +1294,9 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
|
|||||||
|
|
||||||
r1_bio->read_disk = rdisk;
|
r1_bio->read_disk = rdisk;
|
||||||
|
|
||||||
|
if (!r1bio_existed && blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
|
||||||
|
r1_bio->start_time = bio_start_io_acct(bio);
|
||||||
|
|
||||||
read_bio = bio_clone_fast(bio, gfp, &mddev->bio_set);
|
read_bio = bio_clone_fast(bio, gfp, &mddev->bio_set);
|
||||||
|
|
||||||
r1_bio->bios[rdisk] = read_bio;
|
r1_bio->bios[rdisk] = read_bio;
|
||||||
@ -1461,6 +1466,8 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
|
|||||||
r1_bio->sectors = max_sectors;
|
r1_bio->sectors = max_sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
|
||||||
|
r1_bio->start_time = bio_start_io_acct(bio);
|
||||||
atomic_set(&r1_bio->remaining, 1);
|
atomic_set(&r1_bio->remaining, 1);
|
||||||
atomic_set(&r1_bio->behind_remaining, 0);
|
atomic_set(&r1_bio->behind_remaining, 0);
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ struct r1bio {
|
|||||||
sector_t sector;
|
sector_t sector;
|
||||||
int sectors;
|
int sectors;
|
||||||
unsigned long state;
|
unsigned long state;
|
||||||
|
unsigned long start_time;
|
||||||
struct mddev *mddev;
|
struct mddev *mddev;
|
||||||
/*
|
/*
|
||||||
* original bio going to /dev/mdx
|
* original bio going to /dev/mdx
|
||||||
|
Loading…
Reference in New Issue
Block a user