linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Detail: adding sync status for cluster device
@ 2020-04-13 14:41 Lidong Zhong
  2020-04-14  7:25 ` Guoqing Jiang
  0 siblings, 1 reply; 5+ messages in thread
From: Lidong Zhong @ 2020-04-13 14:41 UTC (permalink / raw)
  To: jes, linux-raid; +Cc: guoqing.jiang, Lidong Zhong

On the node with /proc/mdstat is

Personalities : [raid1]
md0 : active raid1 sdb[4] sdc[3] sdd[2]
      1046528 blocks super 1.2 [3/2] [UU_]
        recover=REMOTE
      bitmap: 1/1 pages [4KB], 65536KB chunk

the 'State' of 'mdadm -Q -D' is accordingly
State : clean, degraded
With this patch, it will be
State : clean, degraded, recovering (REMOTE)

Signed-off-by: Lidong Zhong <lidong.zhong@suse.com>
---
 Detail.c | 9 ++++++---
 mdadm.h  | 3 ++-
 mdstat.c | 2 ++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Detail.c b/Detail.c
index 832485f..03d5e04 100644
--- a/Detail.c
+++ b/Detail.c
@@ -496,17 +496,20 @@ int Detail(char *dev, struct context *c)
 			} else
 				arrayst = "active";
 
-			printf("             State : %s%s%s%s%s%s \n",
+			printf("             State : %s%s%s%s%s%s%s \n",
 			       arrayst, st,
 			       (!e || (e->percent < 0 &&
 				       e->percent != RESYNC_PENDING &&
-				       e->percent != RESYNC_DELAYED)) ?
+				       e->percent != RESYNC_DELAYED &&
+				       e->percent != RESYNC_REMOTE)) ?
 			       "" : sync_action[e->resync],
 			       larray_size ? "": ", Not Started",
 			       (e && e->percent == RESYNC_DELAYED) ?
 			       " (DELAYED)": "",
 			       (e && e->percent == RESYNC_PENDING) ?
-			       " (PENDING)": "");
+			       " (PENDING)": "",
+			       (e && e->percent == RESYNC_REMOTE) ?
+			       " (REMOTE)": "");
 		} else if (inactive && !is_container) {
 			printf("             State : inactive\n");
 		}
diff --git a/mdadm.h b/mdadm.h
index d94569f..399478b 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1815,7 +1815,8 @@ enum r0layout {
 #define RESYNC_NONE -1
 #define RESYNC_DELAYED -2
 #define RESYNC_PENDING -3
-#define RESYNC_UNKNOWN -4
+#define RESYNC_REMOTE  -4
+#define RESYNC_UNKNOWN -5
 
 /* When using "GET_DISK_INFO" it isn't certain how high
  * we need to check.  So we impose an absolute limit of
diff --git a/mdstat.c b/mdstat.c
index 7e600d0..20577a3 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -257,6 +257,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 					ent->percent = RESYNC_DELAYED;
 				if (l > 8 && strcmp(w+l-8, "=PENDING") == 0)
 					ent->percent = RESYNC_PENDING;
+				if (l > 7 && strcmp(w+l-7, "=REMOTE") == 0)
+					ent->percent = RESYNC_REMOTE;
 			} else if (ent->percent == RESYNC_NONE &&
 				   w[0] >= '0' &&
 				   w[0] <= '9' &&
-- 
2.16.4

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

* Re: [PATCH] Detail: adding sync status for cluster device
  2020-04-13 14:41 [PATCH] Detail: adding sync status for cluster device Lidong Zhong
@ 2020-04-14  7:25 ` Guoqing Jiang
  2020-04-14  8:03   ` Zhong Lidong
  0 siblings, 1 reply; 5+ messages in thread
From: Guoqing Jiang @ 2020-04-14  7:25 UTC (permalink / raw)
  To: Lidong Zhong, jes, linux-raid

On 13.04.20 16:41, Lidong Zhong wrote:
> On the node with /proc/mdstat is
>
> Personalities : [raid1]
> md0 : active raid1 sdb[4] sdc[3] sdd[2]
>        1046528 blocks super 1.2 [3/2] [UU_]
>          recover=REMOTE
>        bitmap: 1/1 pages [4KB], 65536KB chunk
>
> the 'State' of 'mdadm -Q -D' is accordingly

Maybe rephrase it a little bit, something like.

"Let's change the 'State' of 'mdadm -Q -D' accordingly "

Just FYI.

> State : clean, degraded
> With this patch, it will be
> State : clean, degraded, recovering (REMOTE)
>
> Signed-off-by: Lidong Zhong <lidong.zhong@suse.com>
> ---
>   Detail.c | 9 ++++++---
>   mdadm.h  | 3 ++-
>   mdstat.c | 2 ++
>   3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/Detail.c b/Detail.c
> index 832485f..03d5e04 100644
> --- a/Detail.c
> +++ b/Detail.c
> @@ -496,17 +496,20 @@ int Detail(char *dev, struct context *c)
>   			} else
>   				arrayst = "active";
>   
> -			printf("             State : %s%s%s%s%s%s \n",
> +			printf("             State : %s%s%s%s%s%s%s \n",
>   			       arrayst, st,
>   			       (!e || (e->percent < 0 &&
>   				       e->percent != RESYNC_PENDING &&
> -				       e->percent != RESYNC_DELAYED)) ?
> +				       e->percent != RESYNC_DELAYED &&
> +				       e->percent != RESYNC_REMOTE)) ?
>   			       "" : sync_action[e->resync],
>   			       larray_size ? "": ", Not Started",
>   			       (e && e->percent == RESYNC_DELAYED) ?
>   			       " (DELAYED)": "",
>   			       (e && e->percent == RESYNC_PENDING) ?
> -			       " (PENDING)": "");
> +			       " (PENDING)": "",
> +			       (e && e->percent == RESYNC_REMOTE) ?
> +			       " (REMOTE)": "");
>   		} else if (inactive && !is_container) {
>   			printf("             State : inactive\n");
>   		}
> diff --git a/mdadm.h b/mdadm.h
> index d94569f..399478b 100644
> --- a/mdadm.h
> +++ b/mdadm.h
> @@ -1815,7 +1815,8 @@ enum r0layout {
>   #define RESYNC_NONE -1
>   #define RESYNC_DELAYED -2
>   #define RESYNC_PENDING -3
> -#define RESYNC_UNKNOWN -4
> +#define RESYNC_REMOTE  -4
> +#define RESYNC_UNKNOWN -5
>   
>   /* When using "GET_DISK_INFO" it isn't certain how high
>    * we need to check.  So we impose an absolute limit of
> diff --git a/mdstat.c b/mdstat.c
> index 7e600d0..20577a3 100644
> --- a/mdstat.c
> +++ b/mdstat.c
> @@ -257,6 +257,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
>   					ent->percent = RESYNC_DELAYED;
>   				if (l > 8 && strcmp(w+l-8, "=PENDING") == 0)
>   					ent->percent = RESYNC_PENDING;
> +				if (l > 7 && strcmp(w+l-7, "=REMOTE") == 0)
> +					ent->percent = RESYNC_REMOTE;
>   			} else if (ent->percent == RESYNC_NONE &&
>   				   w[0] >= '0' &&
>   				   w[0] <= '9' &&

Acked-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>

Thanks,
Guoqing

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

* Re: [PATCH] Detail: adding sync status for cluster device
  2020-04-14  7:25 ` Guoqing Jiang
@ 2020-04-14  8:03   ` Zhong Lidong
  2020-04-27 14:33     ` Jes Sorensen
  0 siblings, 1 reply; 5+ messages in thread
From: Zhong Lidong @ 2020-04-14  8:03 UTC (permalink / raw)
  To: Guoqing Jiang, jes, linux-raid



On 4/14/20 3:25 PM, Guoqing Jiang wrote:
> On 13.04.20 16:41, Lidong Zhong wrote:
>> On the node with /proc/mdstat is
>>
>> Personalities : [raid1]
>> md0 : active raid1 sdb[4] sdc[3] sdd[2]
>>        1046528 blocks super 1.2 [3/2] [UU_]
>>          recover=REMOTE
>>        bitmap: 1/1 pages [4KB], 65536KB chunk
>>
>> the 'State' of 'mdadm -Q -D' is accordingly
> 
> Maybe rephrase it a little bit, something like.
> 
> "Let's change the 'State' of 'mdadm -Q -D' accordingly "
> 
> Just FYI .
> 

Thank you for your suggestion, Guoqing. I'll send the
patch again.

Regards,
Lidong
>> State : clean, degraded
>> With this patch, it will be
>> State : clean, degraded, recovering (REMOTE)
>>
>> Signed-off-by: Lidong Zhong <lidong.zhong@suse.com>
>> ---
>>   Detail.c | 9 ++++++---
>>   mdadm.h  | 3 ++-
>>   mdstat.c | 2 ++
>>   3 files changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/Detail.c b/Detail.c
>> index 832485f..03d5e04 100644
>> --- a/Detail.c
>> +++ b/Detail.c
>> @@ -496,17 +496,20 @@ int Detail(char *dev, struct context *c)
>>               } else
>>                   arrayst = "active";
>>   -            printf("             State : %s%s%s%s%s%s \n",
>> +            printf("             State : %s%s%s%s%s%s%s \n",
>>                      arrayst, st,
>>                      (!e || (e->percent < 0 &&
>>                          e->percent != RESYNC_PENDING &&
>> -                       e->percent != RESYNC_DELAYED)) ?
>> +                       e->percent != RESYNC_DELAYED &&
>> +                       e->percent != RESYNC_REMOTE)) ?
>>                      "" : sync_action[e->resync],
>>                      larray_size ? "": ", Not Started",
>>                      (e && e->percent == RESYNC_DELAYED) ?
>>                      " (DELAYED)": "",
>>                      (e && e->percent == RESYNC_PENDING) ?
>> -                   " (PENDING)": "");
>> +                   " (PENDING)": "",
>> +                   (e && e->percent == RESYNC_REMOTE) ?
>> +                   " (REMOTE)": "");
>>           } else if (inactive && !is_container) {
>>               printf("             State : inactive\n");
>>           }
>> diff --git a/mdadm.h b/mdadm.h
>> index d94569f..399478b 100644
>> --- a/mdadm.h
>> +++ b/mdadm.h
>> @@ -1815,7 +1815,8 @@ enum r0layout {
>>   #define RESYNC_NONE -1
>>   #define RESYNC_DELAYED -2
>>   #define RESYNC_PENDING -3
>> -#define RESYNC_UNKNOWN -4
>> +#define RESYNC_REMOTE  -4
>> +#define RESYNC_UNKNOWN -5
>>     /* When using "GET_DISK_INFO" it isn't certain how high
>>    * we need to check.  So we impose an absolute limit of
>> diff --git a/mdstat.c b/mdstat.c
>> index 7e600d0..20577a3 100644
>> --- a/mdstat.c
>> +++ b/mdstat.c
>> @@ -257,6 +257,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
>>                       ent->percent = RESYNC_DELAYED;
>>                   if (l > 8 && strcmp(w+l-8, "=PENDING") == 0)
>>                       ent->percent = RESYNC_PENDING;
>> +                if (l > 7 && strcmp(w+l-7, "=REMOTE") == 0)
>> +                    ent->percent = RESYNC_REMOTE;
>>               } else if (ent->percent == RESYNC_NONE &&
>>                      w[0] >= '0' &&
>>                      w[0] <= '9' &&
> 
> Acked-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> 
> Thanks,
> Guoqing

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

* [PATCH] Detail: adding sync status for cluster device
@ 2020-04-14  8:19 Lidong Zhong
  0 siblings, 0 replies; 5+ messages in thread
From: Lidong Zhong @ 2020-04-14  8:19 UTC (permalink / raw)
  To: jes, linux-raid; +Cc: guoqing.jiang, Lidong Zhong

On the node with /proc/mdstat is

Personalities : [raid1]
md0 : active raid1 sdb[4] sdc[3] sdd[2]
      1046528 blocks super 1.2 [3/2] [UU_]
        recover=REMOTE
      bitmap: 1/1 pages [4KB], 65536KB chunk

Let's change the 'State' of 'mdadm -Q -D' accordingly
State : clean, degraded
With this patch, it will be
State : clean, degraded, recovering (REMOTE)

Signed-off-by: Lidong Zhong <lidong.zhong@suse.com>
Acked-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
 Detail.c | 9 ++++++---
 mdadm.h  | 3 ++-
 mdstat.c | 2 ++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Detail.c b/Detail.c
index 832485f..03d5e04 100644
--- a/Detail.c
+++ b/Detail.c
@@ -496,17 +496,20 @@ int Detail(char *dev, struct context *c)
 			} else
 				arrayst = "active";
 
-			printf("             State : %s%s%s%s%s%s \n",
+			printf("             State : %s%s%s%s%s%s%s \n",
 			       arrayst, st,
 			       (!e || (e->percent < 0 &&
 				       e->percent != RESYNC_PENDING &&
-				       e->percent != RESYNC_DELAYED)) ?
+				       e->percent != RESYNC_DELAYED &&
+				       e->percent != RESYNC_REMOTE)) ?
 			       "" : sync_action[e->resync],
 			       larray_size ? "": ", Not Started",
 			       (e && e->percent == RESYNC_DELAYED) ?
 			       " (DELAYED)": "",
 			       (e && e->percent == RESYNC_PENDING) ?
-			       " (PENDING)": "");
+			       " (PENDING)": "",
+			       (e && e->percent == RESYNC_REMOTE) ?
+			       " (REMOTE)": "");
 		} else if (inactive && !is_container) {
 			printf("             State : inactive\n");
 		}
diff --git a/mdadm.h b/mdadm.h
index d94569f..399478b 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1815,7 +1815,8 @@ enum r0layout {
 #define RESYNC_NONE -1
 #define RESYNC_DELAYED -2
 #define RESYNC_PENDING -3
-#define RESYNC_UNKNOWN -4
+#define RESYNC_REMOTE  -4
+#define RESYNC_UNKNOWN -5
 
 /* When using "GET_DISK_INFO" it isn't certain how high
  * we need to check.  So we impose an absolute limit of
diff --git a/mdstat.c b/mdstat.c
index 7e600d0..20577a3 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -257,6 +257,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 					ent->percent = RESYNC_DELAYED;
 				if (l > 8 && strcmp(w+l-8, "=PENDING") == 0)
 					ent->percent = RESYNC_PENDING;
+				if (l > 7 && strcmp(w+l-7, "=REMOTE") == 0)
+					ent->percent = RESYNC_REMOTE;
 			} else if (ent->percent == RESYNC_NONE &&
 				   w[0] >= '0' &&
 				   w[0] <= '9' &&
-- 
2.16.4

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

* Re: [PATCH] Detail: adding sync status for cluster device
  2020-04-14  8:03   ` Zhong Lidong
@ 2020-04-27 14:33     ` Jes Sorensen
  0 siblings, 0 replies; 5+ messages in thread
From: Jes Sorensen @ 2020-04-27 14:33 UTC (permalink / raw)
  To: Zhong Lidong, Guoqing Jiang, linux-raid

On 4/14/20 4:03 AM, Zhong Lidong wrote:
> 
> 
> On 4/14/20 3:25 PM, Guoqing Jiang wrote:
>> On 13.04.20 16:41, Lidong Zhong wrote:
>>> On the node with /proc/mdstat is
>>>
>>> Personalities : [raid1]
>>> md0 : active raid1 sdb[4] sdc[3] sdd[2]
>>>        1046528 blocks super 1.2 [3/2] [UU_]
>>>          recover=REMOTE
>>>        bitmap: 1/1 pages [4KB], 65536KB chunk
>>>
>>> the 'State' of 'mdadm -Q -D' is accordingly
>>
>> Maybe rephrase it a little bit, something like.
>>
>> "Let's change the 'State' of 'mdadm -Q -D' accordingly "
>>
>> Just FYI .
>>
> 
> Thank you for your suggestion, Guoqing. I'll send the
> patch again.
> 

Please mark the patch as v2 when you repost it with a change like this.

Thanks,
Jes

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

end of thread, other threads:[~2020-04-27 14:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-13 14:41 [PATCH] Detail: adding sync status for cluster device Lidong Zhong
2020-04-14  7:25 ` Guoqing Jiang
2020-04-14  8:03   ` Zhong Lidong
2020-04-27 14:33     ` Jes Sorensen
  -- strict thread matches above, loose matches on Subject: below --
2020-04-14  8:19 Lidong Zhong

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