diff options
author | Czarnowska, Anna <anna.czarnowska@intel.com> | 2011-02-22 01:25:07 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-02-22 01:25:07 +0100 |
commit | c21e737ba12903ecf3a4f42a119807d328f3f8c9 (patch) | |
tree | 029b740e595b49559b34c4923af0d1f8508a6bd5 /super0.c | |
parent | fix: memory leak in Create (diff) | |
download | mdadm-c21e737ba12903ecf3a4f42a119807d328f3f8c9.tar.xz mdadm-c21e737ba12903ecf3a4f42a119807d328f3f8c9.zip |
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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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) |