linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Create: check for UnSet when looking at chunk
@ 2011-03-30 11:28 Czarnowska, Anna
  2011-04-04 23:32 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Czarnowska, Anna @ 2011-03-30 11:28 UTC (permalink / raw)
  To: neilb@suse.de
  Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed,
	Neubauer, Wojciech

From ceb5a3431f27b5030d964567dedb0f983862b347 Mon Sep 17 00:00:00 2001
From: Anna Czarnowska <anna.czarnowska@intel.com>
Date: Wed, 30 Mar 2011 13:21:21 +0200
Subject: [PATCH 1/2] Create: check for UnSet when looking at chunk
Cc: linux-raid@vger.kernel.org, Williams, Dan J <dan.j.williams@intel.com>, Ciechanowski, Ed <ed.ciechanowski@intel.com>

A default chunk size of 0 gets modified to UnSet, so any location that
checks for !chunk really needs to check for !(chunk || chunk == UnSet).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
---
 Create.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Create.c b/Create.c
index 9f34425..5709baf 100644
--- a/Create.c
+++ b/Create.c
@@ -266,7 +266,7 @@ int Create(struct supertype *st, char *mddev,
 					      &chunk, size*2, NULL, &newsize, verbose>=0))
 		return 1;
 
-	if (chunk) {
+	if (chunk && chunk != UnSet) {
 		newsize &= ~(unsigned long long)(chunk*2 - 1);
 		size &= ~(unsigned long long)(chunk - 1);
 	}
@@ -353,7 +353,7 @@ int Create(struct supertype *st, char *mddev,
 		}
 
 		freesize /= 2; /* convert to K */
-		if (chunk) {
+		if (chunk && chunk != UnSet) {
 			/* round to chunk size */
 			freesize = freesize & ~(chunk-1);
 		}
-- 
1.7.1


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

* Re: [PATCH 1/2] Create: check for UnSet when looking at chunk
  2011-03-30 11:28 [PATCH 1/2] Create: check for UnSet when looking at chunk Czarnowska, Anna
@ 2011-04-04 23:32 ` NeilBrown
  0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2011-04-04 23:32 UTC (permalink / raw)
  To: Czarnowska, Anna
  Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed,
	Neubauer, Wojciech

On Wed, 30 Mar 2011 12:28:11 +0100 "Czarnowska, Anna"
<anna.czarnowska@intel.com> wrote:

> >From ceb5a3431f27b5030d964567dedb0f983862b347 Mon Sep 17 00:00:00 2001
> From: Anna Czarnowska <anna.czarnowska@intel.com>
> Date: Wed, 30 Mar 2011 13:21:21 +0200
> Subject: [PATCH 1/2] Create: check for UnSet when looking at chunk
> Cc: linux-raid@vger.kernel.org, Williams, Dan J <dan.j.williams@intel.com>, Ciechanowski, Ed <ed.ciechanowski@intel.com>
> 
> A default chunk size of 0 gets modified to UnSet, so any location that
> checks for !chunk really needs to check for !(chunk || chunk == UnSet).
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>

This and the next one both applied - thanks.

NeilBrown


> ---
>  Create.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Create.c b/Create.c
> index 9f34425..5709baf 100644
> --- a/Create.c
> +++ b/Create.c
> @@ -266,7 +266,7 @@ int Create(struct supertype *st, char *mddev,
>  					      &chunk, size*2, NULL, &newsize, verbose>=0))
>  		return 1;
>  
> -	if (chunk) {
> +	if (chunk && chunk != UnSet) {
>  		newsize &= ~(unsigned long long)(chunk*2 - 1);
>  		size &= ~(unsigned long long)(chunk - 1);
>  	}
> @@ -353,7 +353,7 @@ int Create(struct supertype *st, char *mddev,
>  		}
>  
>  		freesize /= 2; /* convert to K */
> -		if (chunk) {
> +		if (chunk && chunk != UnSet) {
>  			/* round to chunk size */
>  			freesize = freesize & ~(chunk-1);
>  		}


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

end of thread, other threads:[~2011-04-04 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 11:28 [PATCH 1/2] Create: check for UnSet when looking at chunk Czarnowska, Anna
2011-04-04 23:32 ` NeilBrown

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