From: NeilBrown <neilb@suse.de>
To: Gu Zheng <guz.fnst@cn.fujitsu.com>
Cc: sim@hostway.ca, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] md: fix md io stats accounting broken
Date: Wed, 8 Apr 2015 13:11:55 +1000 [thread overview]
Message-ID: <20150408131155.7e3aa2d3@notabene.brown> (raw)
In-Reply-To: <1428021887-18128-1-git-send-email-guz.fnst@cn.fujitsu.com>
[-- Attachment #1: Type: text/plain, Size: 2752 bytes --]
On Fri, 3 Apr 2015 08:44:47 +0800 Gu Zheng <guz.fnst@cn.fujitsu.com> wrote:
> Simon reported the md io stats accounting issue:
> "
> I'm seeing "iostat -x -k 1" print this after a RAID1 rebuild on 4.0-rc5.
> It's not abnormal other than it's 3-disk, with one being SSD (sdc) and
> the other two being write-mostly:
>
> Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
> sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> md0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 345.00 0.00 0.00 0.00 0.00 100.00
> md2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 58779.00 0.00 0.00 0.00 0.00 100.00
> md1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12.00 0.00 0.00 0.00 0.00 100.00
> "
> The cause is commit "18c0b223cf9901727ef3b02da6711ac930b4e5d4" uses the
> generic_start_io_acct to account the disk stats rather than the open code,
> but it also introduced the increase to .in_flight[rw] which is needless to
> md. So we re-use the open code here to fix it.
>
> Reported-by: Simon Kirby <sim@hostway.ca>
> Cc: <stable@vger.kernel.org> 3.19
> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> ---
> drivers/md/md.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 717daad..e617878 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -249,6 +249,7 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
> const int rw = bio_data_dir(bio);
> struct mddev *mddev = q->queuedata;
> unsigned int sectors;
> + int cpu;
>
> if (mddev == NULL || mddev->pers == NULL
> || !mddev->ready) {
> @@ -284,7 +285,10 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
> sectors = bio_sectors(bio);
> mddev->pers->make_request(mddev, bio);
>
> - generic_start_io_acct(rw, sectors, &mddev->gendisk->part0);
> + cpu = part_stat_lock();
> + part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]);
> + part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors);
> + part_stat_unlock();
>
> if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended)
> wake_up(&mddev->sb_wait);
Applied, thanks.
Will push to Linus in a day or 2.
NeilBrown
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
prev parent reply other threads:[~2015-04-08 3:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-03 0:44 [PATCH] md: fix md io stats accounting broken Gu Zheng
2015-04-08 3:11 ` NeilBrown [this message]
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=20150408131155.7e3aa2d3@notabene.brown \
--to=neilb@suse.de \
--cc=guz.fnst@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=sim@hostway.ca \
--cc=stable@vger.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;
as well as URLs for NNTP newsgroup(s).