diff options
author | Dan Williams <dan.j.williams@intel.com> | 2010-11-18 10:22:33 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-11-23 05:20:50 +0100 |
commit | 30f58b2208778245963ee5562f4b2efbde3188cf (patch) | |
tree | 900b35637f71a9daff7be00c4d40eef014110357 /Create.c | |
parent | fix a get_linux_version() comparison typo (diff) | |
download | mdadm-30f58b2208778245963ee5562f4b2efbde3188cf.tar.xz mdadm-30f58b2208778245963ee5562f4b2efbde3188cf.zip |
Create: cleanup/unify default geometry handling
Support metadata specific level, layout and chunksize defaults. Kill an
uneeded superswitch methods ahead of adding more for the reshape case.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Create.c')
-rw-r--r-- | Create.c | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -31,8 +31,8 @@ static int default_layout(struct supertype *st, int level, int verbose) { int layout = UnSet; - if (st && st->ss->default_layout) - layout = st->ss->default_layout(level); + if (st && st->ss->default_geometry) + st->ss->default_geometry(st, &level, &layout, NULL); if (layout == UnSet) switch(level) { @@ -120,15 +120,8 @@ int Create(struct supertype *st, char *mddev, int major_num = BITMAP_MAJOR_HI; memset(&info, 0, sizeof(info)); - - if (level == UnSet) { - /* "ddf" and "imsm" metadata only supports one level - should possibly - * push this into metadata handler?? - */ - if (st && (st->ss == &super_ddf || st->ss == &super_imsm)) - level = LEVEL_CONTAINER; - } - + if (level == UnSet && st && st->ss->default_geometry) + st->ss->default_geometry(st, &level, NULL, NULL); if (level == UnSet) { fprintf(stderr, Name ": a RAID level is needed to create an array.\n"); @@ -235,11 +228,9 @@ int Create(struct supertype *st, char *mddev, case 6: case 0: if (chunk == 0) { - if (st && st->ss->default_chunk) - chunk = st->ss->default_chunk(st); - + if (st && st->ss->default_geometry) + st->ss->default_geometry(st, NULL, NULL, &chunk); chunk = chunk ? : 512; - if (verbose > 0) fprintf(stderr, Name ": chunk size defaults to %dK\n", chunk); } |