All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mdadm: add checking the clustered bitmap in assemble mode
@ 2017-03-01  7:47 Zhilong Liu
  2017-03-01 12:03 ` Coly Li
  0 siblings, 1 reply; 3+ messages in thread
From: Zhilong Liu @ 2017-03-01  7:47 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu

1. both clustered and internal array don't need to specify
--bitmap when assembling array.
2. clustered array doesn't support external bitmap mode.

Signed-off-by: Zhilong Liu <zlliu@suse.com>

diff --git a/mdadm.c b/mdadm.c
index b5d89e4..b08cace 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1095,8 +1095,14 @@ int main(int argc, char *argv[])
 				pr_err("bitmap file needed with -b in --assemble mode\n");
 				exit(2);
 			}
-			if (strcmp(optarg, "internal") == 0) {
-				pr_err("there is no need to specify --bitmap when assembling arrays with internal bitmaps\n");
+			if (strcmp(optarg, "internal") == 0 ||
+			    strcmp(optarg, "clustered") == 0) {
+				pr_err("no need to specify --bitmap when assembling arrays with internal or clustered bitmaps\n");
+				continue;
+			}
+			if (strcmp(optarg, "clustered") == 0 &&
+			    strchr(optarg, '/') != NULL) {
+				pr_err("clustered array doesn't support external bitmap\n");
 				continue;
 			}
 			bitmap_fd = open(optarg, O_RDWR);
-- 
2.6.6


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

* Re: [PATCH] mdadm: add checking the clustered bitmap in assemble mode
  2017-03-01  7:47 [PATCH] mdadm: add checking the clustered bitmap in assemble mode Zhilong Liu
@ 2017-03-01 12:03 ` Coly Li
  2017-03-01 16:32   ` Zhilong
  0 siblings, 1 reply; 3+ messages in thread
From: Coly Li @ 2017-03-01 12:03 UTC (permalink / raw)
  To: Zhilong Liu, Jes.Sorensen; +Cc: linux-raid

On 2017/3/1 下午3:47, Zhilong Liu wrote:
> 1. both clustered and internal array don't need to specify
> --bitmap when assembling array.
> 2. clustered array doesn't support external bitmap mode.
> 
> Signed-off-by: Zhilong Liu <zlliu@suse.com>
> 
> diff --git a/mdadm.c b/mdadm.c
> index b5d89e4..b08cace 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -1095,8 +1095,14 @@ int main(int argc, char *argv[])
>  				pr_err("bitmap file needed with -b in --assemble mode\n");
>  				exit(2);
>  			}
> -			if (strcmp(optarg, "internal") == 0) {
> -				pr_err("there is no need to specify --bitmap when assembling arrays with internal bitmaps\n");
> +			if (strcmp(optarg, "internal") == 0 ||
> +			    strcmp(optarg, "clustered") == 0) {
> +				pr_err("no need to specify --bitmap when assembling arrays with internal or clustered bitmaps\n");

Is it important for 80 characters width limitation ?

> +				continue;

Here if optarg is "clustered", it will continue and won't check the
following strcmp.

> +			}
> +			if (strcmp(optarg, "clustered") == 0 &&
> +			    strchr(optarg, '/') != NULL) {

I guess this check won't happen at all. Correct me if I am wrong.

> +				pr_err("clustered array doesn't support external bitmap\n");
>  				continue;
>  			}
>  			bitmap_fd = open(optarg, O_RDWR);
> 

Thanks.

Coly

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

* Re: [PATCH] mdadm: add checking the clustered bitmap in assemble mode
  2017-03-01 12:03 ` Coly Li
@ 2017-03-01 16:32   ` Zhilong
  0 siblings, 0 replies; 3+ messages in thread
From: Zhilong @ 2017-03-01 16:32 UTC (permalink / raw)
  To: Coly Li; +Cc: Jes.Sorensen, linux-raid



> 在 2017年3月1日,20:03,Coly Li <colyli@suse.de> 写道:
> 
>> On 2017/3/1 下午3:47, Zhilong Liu wrote:
>> 1. both clustered and internal array don't need to specify
>> --bitmap when assembling array.
>> 2. clustered array doesn't support external bitmap mode.
>> 
>> Signed-off-by: Zhilong Liu <zlliu@suse.com>
>> 
>> diff --git a/mdadm.c b/mdadm.c
>> index b5d89e4..b08cace 100644
>> --- a/mdadm.c
>> +++ b/mdadm.c
>> @@ -1095,8 +1095,14 @@ int main(int argc, char *argv[])
>>                pr_err("bitmap file needed with -b in --assemble mode\n");
>>                exit(2);
>>            }
>> -            if (strcmp(optarg, "internal") == 0) {
>> -                pr_err("there is no need to specify --bitmap when assembling arrays with internal bitmaps\n");
>> +            if (strcmp(optarg, "internal") == 0 ||
>> +                strcmp(optarg, "clustered") == 0) {
>> +                pr_err("no need to specify --bitmap when assembling arrays with internal or clustered bitmaps\n");
> 
> Is it important for 80 characters width limitation ?
> 
To keep good style, the suggestion is great.
>> +                continue;
> 
> Here if optarg is "clustered", it will continue and won't check the
> following strcmp.
> 
>> +            }
>> +            if (strcmp(optarg, "clustered") == 0 &&
>> +                strchr(optarg, '/') != NULL) {
> 
> I guess this check won't happen at all. Correct me if I am wrong.
Yes, I should do this checking in 'create' and 'grow' mode. The first checking is enough in assemble mode.
> 
>> +                pr_err("clustered array doesn't support external bitmap\n");
>>                continue;
>>            }
>>            bitmap_fd = open(optarg, O_RDWR);
>> 
> 
> Thanks.
> 
> Coly
Many many thanks,
Zhilong

send from iPhone

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

end of thread, other threads:[~2017-03-01 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01  7:47 [PATCH] mdadm: add checking the clustered bitmap in assemble mode Zhilong Liu
2017-03-01 12:03 ` Coly Li
2017-03-01 16:32   ` Zhilong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.