public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: Guoqing Jiang <jgq516@gmail.com>
To: Artur Paszkiewicz <artur.paszkiewicz@intel.com>, song@kernel.org
Cc: linux-raid@vger.kernel.org, Guoqing Jiang <jiangguoqing@kylinos.cn>
Subject: Re: [PATCH 2/5] md: the latest try for improve io stats accounting
Date: Wed, 19 May 2021 16:09:04 +0800	[thread overview]
Message-ID: <c63b1793-e83e-f729-cd97-2f34b43166dd@gmail.com> (raw)
In-Reply-To: <d788bc1f-3fd9-a293-2f2a-6047fdd45625@intel.com>



On 5/19/21 3:26 PM, Artur Paszkiewicz wrote:
> On 19.05.2021 03:30, Guoqing Jiang wrote:
>> Hmm, raid0 allocates split bio from mddev->bio_set, but raid5 is
>> different, it splits bio from r5conf->bio_split. So either let raid5 also
>> splits bio from mddev->bio_set, or add an additional checking for
>> raid5. Thoughts?
> It looks like raid5 has a different bio set for that because it uses
> mddev->bio_set for something else - allocating a bio for rdev. So I
> think it can be changed to split from mddev->bio_set and have a private
> bio set for the rdev bio allocation.


Instead of add a flag, I tried this way:

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index e5d7411cba9b..d309b639b5d9 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -748,6 +748,19 @@ static void raid0_quiesce(struct mddev *mddev, int 
quiesce)
  {
  }

+/*
+ * Don't account the bio if it was split from mddev->bio_set.
+ */
+static bool raid0_accounting_bio(struct mddev *mddev, struct bio *bio)
+{
+       bool ret = true;
+
+       if (bio->bi_pool == &mddev->bio_set)
+               ret = false;
+
+       return ret;
+}
+
  static struct md_personality raid0_personality=
  {
         .name           = "raid0",
@@ -760,6 +773,7 @@ static struct md_personality raid0_personality=
         .size           = raid0_size,
         .takeover       = raid0_takeover,
         .quiesce        = raid0_quiesce,
+       .accounting_bio = raid0_accounting_bio,
  };

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 841e1c1aa5e6..070ccf55c534 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8596,6 +8596,20 @@ static void *raid6_takeover(struct mddev *mddev)
         return setup_conf(mddev);
  }

+/*
+ * Don't account the bio if it was split from r5conf->bio_split.
+ */
+static bool raid5_accounting_bio(struct mddev *mddev, struct bio *bio)
+{
+       bool ret = true;
+       struct r5conf *conf = mddev->private;
+
+       if (bio->bi_pool == &conf->bio_split)
+               ret = false;
+
+       return ret;
+}
+
  static int raid5_change_consistency_policy(struct mddev *mddev, const 
char *buf)
  {
         struct r5conf *conf;
@@ -8687,6 +8701,7 @@ static struct md_personality raid6_personality =
         .finish_reshape = raid5_finish_reshape,
         .quiesce        = raid5_quiesce,
         .takeover       = raid6_takeover,
+       .accounting_bio = raid5_accounting_bio,

Thanks,
Guoqing

  parent reply	other threads:[~2021-05-19  8:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18  5:32 [PATCH 0/5] md: io stats accounting Guoqing Jiang
2021-05-18  5:32 ` [PATCH 1/5] md: revert " Guoqing Jiang
2021-05-18  5:32 ` [PATCH 2/5] md: the latest try for improve " Guoqing Jiang
2021-05-18 10:12   ` Artur Paszkiewicz
2021-05-19  1:30     ` Guoqing Jiang
2021-05-19  7:26       ` Artur Paszkiewicz
2021-05-19  7:46         ` Christoph Hellwig
2021-05-19  8:09         ` Guoqing Jiang [this message]
2021-05-20  0:45           ` Song Liu
2021-05-18 13:35   ` Christoph Hellwig
2021-05-19  1:40     ` Guoqing Jiang
2021-05-18  5:32 ` [PATCH 3/5] md-multipath: enable io accounting Guoqing Jiang
2021-05-18 13:37   ` Christoph Hellwig
2021-05-19  1:46     ` Guoqing Jiang
2021-05-18  5:32 ` [PATCH 4/5] md/raid1: " Guoqing Jiang
2021-05-18 13:40   ` Christoph Hellwig
2021-05-19  1:47     ` Guoqing Jiang
2021-05-18  5:32 ` [PATCH 5/5] md/raid10: " Guoqing Jiang
2021-05-19  0:14 ` [PATCH 0/5] md: io stats accounting Song Liu
2021-05-19  1:50   ` Guoqing Jiang

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=c63b1793-e83e-f729-cd97-2f34b43166dd@gmail.com \
    --to=jgq516@gmail.com \
    --cc=artur.paszkiewicz@intel.com \
    --cc=jiangguoqing@kylinos.cn \
    --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