diff mbox series

[v2,2/3] md: use part_[begin|end]_io_acct instead of disk_[begin|end]_io_acct

Message ID 20200818222645.952219-3-songliubraving@fb.com (mailing list archive)
State New, archived
Headers show
Series block: improve iostat for md/bcache partitions | expand

Commit Message

Song Liu Aug. 18, 2020, 10:26 p.m. UTC
This enables proper statistics in /proc/diskstats for md partitions.

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 drivers/md/md.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Christoph Hellwig Aug. 31, 2020, 6:54 a.m. UTC | #1
On Tue, Aug 18, 2020 at 03:26:44PM -0700, Song Liu wrote:
> This enables proper statistics in /proc/diskstats for md partitions.
> 
> Signed-off-by: Song Liu <songliubraving@fb.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 6b511c9007d38..5119370c09a6b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -470,6 +470,7 @@  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)
@@ -477,7 +478,7 @@  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;
@@ -523,9 +524,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 */