public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: <linux-block@vger.kernel.org>, <linux-raid@vger.kernel.org>,
	<linux-bcache@vger.kernel.org>
Cc: <colyli@suse.de>, <axboe@kernel.dk>, <kernel-team@fb.com>,
	<song@kernel.org>, <hch@infradead.org>,
	Song Liu <songliubraving@fb.com>
Subject: [PATCH v2 2/3] md: use part_[begin|end]_io_acct instead of disk_[begin|end]_io_acct
Date: Tue, 18 Aug 2020 15:26:44 -0700	[thread overview]
Message-ID: <20200818222645.952219-3-songliubraving@fb.com> (raw)
In-Reply-To: <20200818222645.952219-1-songliubraving@fb.com>

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(-)

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 */
-- 
2.24.1


  parent reply	other threads:[~2020-08-18 22:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 22:26 [PATCH v2 0/3] block: improve iostat for md/bcache partitions Song Liu
2020-08-18 22:26 ` [PATCH v2 1/3] block: introduce part_[begin|end]_io_acct Song Liu
2020-08-31  6:53   ` Christoph Hellwig
2020-08-31 21:58     ` Song Liu
2020-08-18 22:26 ` Song Liu [this message]
2020-08-31  6:54   ` [PATCH v2 2/3] md: use part_[begin|end]_io_acct instead of disk_[begin|end]_io_acct Christoph Hellwig
2020-08-18 22:26 ` [PATCH v2 3/3] bcache: " Song Liu
2020-08-31  6:54   ` Christoph Hellwig
2020-08-28 18:00 ` [PATCH v2 0/3] block: improve iostat for md/bcache partitions Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200818222645.952219-3-songliubraving@fb.com \
    --to=songliubraving@fb.com \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=hch@infradead.org \
    --cc=kernel-team@fb.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox