linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] skip match_mddev_units check for special roles
@ 2015-09-04  6:00 Song Liu
  2015-09-30  8:06 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Song Liu @ 2015-09-04  6:00 UTC (permalink / raw)
  To: linux-raid; +Cc: shli, neilb, hch, dan.j.williams, hch, Kernel-team, Song Liu

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] skip match_mddev_units check for special roles
  2015-09-04  6:00 [PATCH] skip match_mddev_units check for special roles Song Liu
@ 2015-09-30  8:06 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2015-09-30  8:06 UTC (permalink / raw)
  To: linux-raid; +Cc: shli, hch, dan.j.williams, hch, Kernel-team, Song Liu

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-30  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04  6:00 [PATCH] skip match_mddev_units check for special roles Song Liu
2015-09-30  8:06 ` Neil Brown

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