summaryrefslogtreecommitdiff
path: root/super0.c
diff options
context:
space:
mode:
authorCzarnowska, Anna <anna.czarnowska@intel.com>2011-02-22 11:25:07 +1100
committerNeilBrown <neilb@suse.de>2011-02-22 11:25:07 +1100
commitc21e737ba12903ecf3a4f42a119807d328f3f8c9 (patch)
tree029b740e595b49559b34c4923af0d1f8508a6bd5 /super0.c
parent55425f279ca20b43c151eaf0bc08e6882eef746e (diff)
set default chunk in validate_geometry
When chunk size is not set from command line we need to guess it depending on metadata given on command line or found on listed devices. Validate_geometry sets the default for it's metadata if chunk is not set. For external metadata chunk is set only when creating in a container. For imsm validate_geometry_imsm_orom is responsible for finding default chunk depending on container metadata loaded. Container will already know which controller it is attached to, and have this controllers orom available. do_default_chunk indicates that we need to find default chunk and if validate_geometry fails for some metadata it tells us to reset chunk that may have been set. Current solution would set default chunk correctly for imsm only if container device was given on command line. With the list of devices chunk was always set to 512. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/super0.c b/super0.c
index 0b95dac2..832072d8 100644
--- a/super0.c
+++ b/super0.c
@@ -1090,7 +1090,7 @@ static void free_super0(struct supertype *st)
#ifndef MDASSEMBLE
static int validate_geometry0(struct supertype *st, int level,
int layout, int raiddisks,
- int chunk, unsigned long long size,
+ int *chunk, unsigned long long size,
char *subdev, unsigned long long *freesize,
int verbose)
{
@@ -1116,6 +1116,9 @@ static int validate_geometry0(struct supertype *st, int level,
if (!subdev)
return 1;
+ if (chunk && (*chunk == 0 || *chunk == UnSet))
+ *chunk = DEFAULT_CHUNK;
+
fd = open(subdev, O_RDONLY|O_EXCL, 0);
if (fd < 0) {
if (verbose)