From: NeilBrown <neilb@suse.com>
To: shli@kernel.org, linux-raid@vger.kernel.org
Cc: Shaohua Li <shli@fb.com>
Subject: Re: [PATCH] md:raid1/10: avoid unnecessary locking
Date: Fri, 12 May 2017 08:29:56 +1000 [thread overview]
Message-ID: <87lgq3kowr.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1946dca4cbeb08911e4fcc155d1b2ffa8bc6c0a2.1494431492.git.shli@fb.com>
[-- Attachment #1: Type: text/plain, Size: 2293 bytes --]
On Wed, May 10 2017, shli@kernel.org wrote:
> From: Shaohua Li <shli@fb.com>
>
> If we add bios to block plugging list, locking is unnecessry, since the block
> unplug is guaranteed not to run at that time.
Yes, that make sense. Thanks
Reviewed-by: NeilBrown <neilb@suse.com>
>
> Cc: NeilBrown <neilb@suse.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
> drivers/md/raid1.c | 7 +++----
> drivers/md/raid10.c | 7 +++----
> 2 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 7c1f73398800..a17ed6218d51 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1529,17 +1529,16 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
> plug = container_of(cb, struct raid1_plug_cb, cb);
> else
> plug = NULL;
> - spin_lock_irqsave(&conf->device_lock, flags);
> if (plug) {
> bio_list_add(&plug->pending, mbio);
> plug->pending_cnt++;
> } else {
> + spin_lock_irqsave(&conf->device_lock, flags);
> bio_list_add(&conf->pending_bio_list, mbio);
> conf->pending_count++;
> - }
> - spin_unlock_irqrestore(&conf->device_lock, flags);
> - if (!plug)
> + spin_unlock_irqrestore(&conf->device_lock, flags);
> md_wakeup_thread(mddev->thread);
> + }
> }
>
> r1_bio_write_done(r1_bio);
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 6b86a0032cf8..4343d7ff9916 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -1282,17 +1282,16 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
> plug = container_of(cb, struct raid10_plug_cb, cb);
> else
> plug = NULL;
> - spin_lock_irqsave(&conf->device_lock, flags);
> if (plug) {
> bio_list_add(&plug->pending, mbio);
> plug->pending_cnt++;
> } else {
> + spin_lock_irqsave(&conf->device_lock, flags);
> bio_list_add(&conf->pending_bio_list, mbio);
> conf->pending_count++;
> - }
> - spin_unlock_irqrestore(&conf->device_lock, flags);
> - if (!plug)
> + spin_unlock_irqrestore(&conf->device_lock, flags);
> md_wakeup_thread(mddev->thread);
> + }
> }
>
> static void raid10_write_request(struct mddev *mddev, struct bio *bio,
> --
> 2.11.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
prev parent reply other threads:[~2017-05-11 22:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 15:52 [PATCH] md:raid1/10: avoid unnecessary locking shli
2017-05-11 22:29 ` 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=87lgq3kowr.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=linux-raid@vger.kernel.org \
--cc=shli@fb.com \
--cc=shli@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