Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] md: change the initialization value for a spare device spot to MD_DISK_ROLE_SPARE
@ 2017-06-12  2:45 Lidong Zhong
  2017-06-13 17:17 ` Shaohua Li
  0 siblings, 1 reply; 4+ messages in thread
From: Lidong Zhong @ 2017-06-12  2:45 UTC (permalink / raw)
  To: linux-raid

The value for spare spot of sb->dev_roles is changed from
MD_DISK_ROLE_FAULTY to MD_DISK_ROLE_SPARE to keep align
with the value when the superblock is firstly created in
userspace.

Signed-off-by: Lidong Zhong <lzhong@suse.com>
---
 drivers/md/md.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 87edc342ccb3..a9aacedefbca 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1852,7 +1852,7 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
 		max_dev = le32_to_cpu(sb->max_dev);
 
 	for (i=0; i<max_dev;i++)
-		sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_FAULTY);
+		sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_SPARE);
 
 	if (test_bit(MD_HAS_JOURNAL, &mddev->flags))
 		sb->feature_map |= cpu_to_le32(MD_FEATURE_JOURNAL);
-- 
2.12.0


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

* Re: [PATCH] md: change the initialization value for a spare device spot to MD_DISK_ROLE_SPARE
  2017-06-12  2:45 [PATCH] md: change the initialization value for a spare device spot to MD_DISK_ROLE_SPARE Lidong Zhong
@ 2017-06-13 17:17 ` Shaohua Li
  2017-06-14  3:16   ` Lidong Zhong
  0 siblings, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2017-06-13 17:17 UTC (permalink / raw)
  To: Lidong Zhong, jes.sorensen; +Cc: linux-raid

On Mon, Jun 12, 2017 at 10:45:55AM +0800, Lidong Zhong wrote:
> The value for spare spot of sb->dev_roles is changed from
> MD_DISK_ROLE_FAULTY to MD_DISK_ROLE_SPARE to keep align
> with the value when the superblock is firstly created in
> userspace.

Could you point out where mdadm does this?

I'm wondering what's the impact here. If there is a disk, we will set correct
role at the end of super_1_sync(), otherwise faulty sounds more reasonable.

Jes,
Could you help check this?

Thanks,
Shaohua
 
> Signed-off-by: Lidong Zhong <lzhong@suse.com>
> ---
>  drivers/md/md.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 87edc342ccb3..a9aacedefbca 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -1852,7 +1852,7 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
>  		max_dev = le32_to_cpu(sb->max_dev);
>  
>  	for (i=0; i<max_dev;i++)
> -		sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_FAULTY);
> +		sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_SPARE);
>  
>  	if (test_bit(MD_HAS_JOURNAL, &mddev->flags))
>  		sb->feature_map |= cpu_to_le32(MD_FEATURE_JOURNAL);
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] md: change the initialization value for a spare device spot to MD_DISK_ROLE_SPARE
  2017-06-13 17:17 ` Shaohua Li
@ 2017-06-14  3:16   ` Lidong Zhong
  2017-06-15 17:02     ` Shaohua Li
  0 siblings, 1 reply; 4+ messages in thread
From: Lidong Zhong @ 2017-06-14  3:16 UTC (permalink / raw)
  To: Shaohua Li, jes.sorensen; +Cc: linux-raid



On 06/14/2017 01:17 AM, Shaohua Li wrote:
> On Mon, Jun 12, 2017 at 10:45:55AM +0800, Lidong Zhong wrote:
>> The value for spare spot of sb->dev_roles is changed from
>> MD_DISK_ROLE_FAULTY to MD_DISK_ROLE_SPARE to keep align
>> with the value when the superblock is firstly created in
>> userspace.
>
> Could you point out where mdadm does this?
>
Hi Shaohua,

It's done in init_super1() during initialization.
1615memset(sb->dev_roles,0xff, 
 

1616            MAX_SB_SIZE - sizeof(struct mdp_superblock_1));

> I'm wondering what's the impact here. If there is a disk, we will set correct
> role at the end of super_1_sync(), otherwise faulty sounds more reasonable.
>

Actually there is no impact if it works fine. I found the value for
spare slot in sb->dev_roles is changed while debugging a problem.
That's the reason I submit this patch.

Thanks,
Lidong

> Jes,
> Could you help check this?
>
> Thanks,
> Shaohua
>
>> Signed-off-by: Lidong Zhong <lzhong@suse.com>
>> ---
>>  drivers/md/md.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>> index 87edc342ccb3..a9aacedefbca 100644
>> --- a/drivers/md/md.c
>> +++ b/drivers/md/md.c
>> @@ -1852,7 +1852,7 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
>>  		max_dev = le32_to_cpu(sb->max_dev);
>>
>>  	for (i=0; i<max_dev;i++)
>> -		sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_FAULTY);
>> +		sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_SPARE);
>>
>>  	if (test_bit(MD_HAS_JOURNAL, &mddev->flags))
>>  		sb->feature_map |= cpu_to_le32(MD_FEATURE_JOURNAL);
>> --
>> 2.12.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: [PATCH] md: change the initialization value for a spare device spot to MD_DISK_ROLE_SPARE
  2017-06-14  3:16   ` Lidong Zhong
@ 2017-06-15 17:02     ` Shaohua Li
  0 siblings, 0 replies; 4+ messages in thread
From: Shaohua Li @ 2017-06-15 17:02 UTC (permalink / raw)
  To: Lidong Zhong; +Cc: jes.sorensen, linux-raid

On Wed, Jun 14, 2017 at 11:16:43AM +0800, Lidong Zhong wrote:
> 
> 
> On 06/14/2017 01:17 AM, Shaohua Li wrote:
> > On Mon, Jun 12, 2017 at 10:45:55AM +0800, Lidong Zhong wrote:
> > > The value for spare spot of sb->dev_roles is changed from
> > > MD_DISK_ROLE_FAULTY to MD_DISK_ROLE_SPARE to keep align
> > > with the value when the superblock is firstly created in
> > > userspace.
> > 
> > Could you point out where mdadm does this?
> > 
> Hi Shaohua,
> 
> It's done in init_super1() during initialization.
> 1615memset(sb->dev_roles,0xff,
> 
> 
> 1616            MAX_SB_SIZE - sizeof(struct mdp_superblock_1));
> 
> > I'm wondering what's the impact here. If there is a disk, we will set correct
> > role at the end of super_1_sync(), otherwise faulty sounds more reasonable.
> > 
> 
> Actually there is no impact if it works fine. I found the value for
> spare slot in sb->dev_roles is changed while debugging a problem.
> That's the reason I submit this patch.

ok, let's make it consistent, applied

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

end of thread, other threads:[~2017-06-15 17:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-12  2:45 [PATCH] md: change the initialization value for a spare device spot to MD_DISK_ROLE_SPARE Lidong Zhong
2017-06-13 17:17 ` Shaohua Li
2017-06-14  3:16   ` Lidong Zhong
2017-06-15 17:02     ` Shaohua Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox