[PATCH 1/2] fix: imsm: size must be in K for rounding to chunk

[PATCH 1/2] fix: imsm: size must be in K for rounding to chunk

am 10.02.2011 09:33:33 von anna.czarnowska

From 77d66de281e818f93e97b3150dc0e610634463de Mon Sep 17 00:00:00 2001
From: Anna Czarnowska
Date: Tue, 8 Feb 2011 11:13:14 +0100
Subject: [PATCH 1/2] fix: imsm: size must be in K for rounding to chunk
Cc: linux-raid@vger.kernel.org, Williams, Dan J , Ciechanowski, Ed

chunk is in K so size must be converted to K before it is rounded.
Otherwise we may get wrong freesize returned
resulting in creation failure.

Signed-off-by: Anna Czarnowska
---
super-intel.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 6a21b26..5c16137 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4379,7 +4379,8 @@ static int reserve_space(struct supertype *st, int raiddisks,
maxsize = merge_extents(super, extent_cnt);
minsize = size;
if (size == 0)
- minsize = chunk;
+ /* chunk is in K */
+ minsize = chunk * 2;

if (cnt < raiddisks ||
(super->orom && used && used != raiddisks) ||
@@ -4392,8 +4393,8 @@ static int reserve_space(struct supertype *st, int raiddisks,
if (size == 0) {
size = maxsize;
if (chunk) {
- size /= chunk;
- size *= chunk;
+ size /= 2 * chunk;
+ size *= 2 * chunk;
}
}

--
1.7.1

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

Re: [PATCH 1/2] fix: imsm: size must be in K for rounding to chunk

am 13.02.2011 23:50:16 von NeilBrown

On Thu, 10 Feb 2011 08:33:33 +0000 "Czarnowska, Anna"
wrote:

> >From 77d66de281e818f93e97b3150dc0e610634463de Mon Sep 17 00:00:00 2001
> From: Anna Czarnowska
> Date: Tue, 8 Feb 2011 11:13:14 +0100
> Subject: [PATCH 1/2] fix: imsm: size must be in K for rounding to chunk
> Cc: linux-raid@vger.kernel.org, Williams, Dan J , Ciechanowski, Ed
>
> chunk is in K so size must be converted to K before it is rounded.
> Otherwise we may get wrong freesize returned
> resulting in creation failure.
>
> Signed-off-by: Anna Czarnowska

Thanks. I've applied both patches in this series.

NeilBrown


> ---
> super-intel.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/super-intel.c b/super-intel.c
> index 6a21b26..5c16137 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -4379,7 +4379,8 @@ static int reserve_space(struct supertype *st, int raiddisks,
> maxsize = merge_extents(super, extent_cnt);
> minsize = size;
> if (size == 0)
> - minsize = chunk;
> + /* chunk is in K */
> + minsize = chunk * 2;
>
> if (cnt < raiddisks ||
> (super->orom && used && used != raiddisks) ||
> @@ -4392,8 +4393,8 @@ static int reserve_space(struct supertype *st, int raiddisks,
> if (size == 0) {
> size = maxsize;
> if (chunk) {
> - size /= chunk;
> - size *= chunk;
> + size /= 2 * chunk;
> + size *= 2 * chunk;
> }
> }
>

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