Skip to content

Commit

Permalink
md: use part_[begin|end]_io_acct instead of disk_[begin|end]_io_acct
Browse files Browse the repository at this point in the history
This enables proper statistics in /proc/diskstats for md partitions.

Signed-off-by: Song Liu <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
liu-song-6 authored and axboe committed Sep 11, 2020
1 parent 7b26410 commit 00fe60e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,15 @@ struct md_io {
bio_end_io_t *orig_bi_end_io;
void *orig_bi_private;
unsigned long start_time;
struct hd_struct *part;
};

static void md_end_io(struct bio *bio)
{
struct md_io *md_io = bio->bi_private;
struct mddev *mddev = md_io->mddev;

disk_end_io_acct(mddev->gendisk, bio_op(bio), md_io->start_time);
part_end_io_acct(md_io->part, bio, md_io->start_time);

bio->bi_end_io = md_io->orig_bi_end_io;
bio->bi_private = md_io->orig_bi_private;
Expand Down Expand Up @@ -517,9 +518,8 @@ static blk_qc_t md_submit_bio(struct bio *bio)
bio->bi_end_io = md_end_io;
bio->bi_private = md_io;

md_io->start_time = disk_start_io_acct(mddev->gendisk,
bio_sectors(bio),
bio_op(bio));
md_io->start_time = part_start_io_acct(mddev->gendisk,
&md_io->part, bio);
}

/* bio could be mergeable after passing to underlayer */
Expand Down

0 comments on commit 00fe60e

Please sign in to comment.