linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: linux-raid@vger.kernel.org
Cc: shli@fb.com, hch@infradead.org, dan.j.williams@intel.com,
	hch@lst.de, Kernel-team@fb.com, Song Liu <songliubraving@fb.com>
Subject: Re: [PATCH] skip match_mddev_units check for special roles
Date: Wed, 30 Sep 2015 18:06:34 +1000	[thread overview]
Message-ID: <874micl4ad.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1441346435-4009054-1-git-send-email-songliubraving@fb.com>

[-- Attachment #1: Type: text/plain, Size: 1659 bytes --]

Song Liu <songliubraving@fb.com> writes:

> match_mddev_units is used to check whether 2 RAID arrays share
> same disk(s). Arrays that share disk(s) will not do resync at the
> same time for better performance (fewer HDD seek). However, this
> check should not apply to Spare, Faulty, and Journal disks, as
> they do not paticipate in resync.
>
> In this patch, match_mddev_units skips check for disks with flag
> "Faulty" or "Journal" or raid_disk < 0.
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
>  drivers/md/md.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 95824fb..b96d135 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -1957,13 +1957,23 @@ static int match_mddev_units(struct mddev *mddev1, struct mddev *mddev2)
>  	struct md_rdev *rdev, *rdev2;
>  
>  	rcu_read_lock();
> -	rdev_for_each_rcu(rdev, mddev1)
> -		rdev_for_each_rcu(rdev2, mddev2)
> +	rdev_for_each_rcu(rdev, mddev1) {
> +		if (test_bit(Faulty, &rdev->flags) ||
> +		    test_bit(Journal, &rdev->flags) ||
> +		    rdev->raid_disk == -1)
> +			continue;
> +		rdev_for_each_rcu(rdev2, mddev2) {
> +			if (test_bit(Faulty, &rdev2->flags) ||
> +			    test_bit(Journal, &rdev2->flags) ||
> +			    rdev2->raid_disk == -1)
> +				continue;
>  			if (rdev->bdev->bd_contains ==
>  			    rdev2->bdev->bd_contains) {
>  				rcu_read_unlock();
>  				return 1;
>  			}
> +		}
> +	}
>  	rcu_read_unlock();
>  	return 0;
>  }
> -- 
> 1.8.1

That makes sense.  Applied, thanks.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

      reply	other threads:[~2015-09-30  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-04  6:00 [PATCH] skip match_mddev_units check for special roles Song Liu
2015-09-30  8:06 ` Neil Brown [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=874micl4ad.fsf@notabene.neil.brown.name \
    --to=neilb@suse.de \
    --cc=Kernel-team@fb.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=shli@fb.com \
    --cc=songliubraving@fb.com \
    /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).