linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] fix: imsm: size must be in K for rounding to chunk
@ 2011-02-10  8:33 Czarnowska, Anna
  2011-02-13 22:50 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Czarnowska, Anna @ 2011-02-10  8:33 UTC (permalink / raw)
  To: NeilBrown
  Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed,
	Neubauer, Wojciech

From 77d66de281e818f93e97b3150dc0e610634463de Mon Sep 17 00:00:00 2001
From: Anna Czarnowska <anna.czarnowska@intel.com>
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 <dan.j.williams@intel.com>, Ciechanowski, Ed <ed.ciechanowski@intel.com>

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 <anna.czarnowska@intel.com>
---
 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


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

end of thread, other threads:[~2011-02-13 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-10  8:33 [PATCH 1/2] fix: imsm: size must be in K for rounding to chunk Czarnowska, Anna
2011-02-13 22:50 ` 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).