[PATCH 3/4] md: use part_[begin|end]_io_acct instead of disk_[begin|end]_io_acct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This enables proper statistics in /proc/diskstats for md partitions.

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

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 6b511c9007d38..00ca65b206d13 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,8 @@ 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_op(bio), md_io->start_time);
+	hd_struct_put(md_io->part);
 
 	bio->bi_end_io = md_io->orig_bi_end_io;
 	bio->bi_private = md_io->orig_bi_private;
@@ -523,7 +525,9 @@ 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,
+		md_io->part = disk_map_sector_rcu(mddev->gendisk,
+						  bio->bi_iter.bi_sector);
+		md_io->start_time = part_start_io_acct(md_io->part,
 						       bio_sectors(bio),
 						       bio_op(bio));
 	}
-- 
2.24.1





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux