diff options
author | NeilBrown <neilb@suse.de> | 2011-03-09 08:27:19 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-03-09 08:27:19 +0100 |
commit | bb7295f15e02d8cd8b52de14f40c1d7e10555cc9 (patch) | |
tree | 0bd1bc55baf98be3864b9e3ee5cbd052a55fac9d /Create.c | |
parent | Detail: report subarrays of a container properly. (diff) | |
download | mdadm-bb7295f15e02d8cd8b52de14f40c1d7e10555cc9.tar.xz mdadm-bb7295f15e02d8cd8b52de14f40c1d7e10555cc9.zip |
Fix chunksize defaulting.
the new code for defaulting chunksizes didn't work quite right
- default was set to late in super1/super0/ddf
- defaults would over-ride values of '0' imposed by some levels
- default value wasn't applied to size properly.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Create.c')
-rw-r--r-- | Create.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -230,9 +230,11 @@ int Create(struct supertype *st, char *mddev, case 10: case 6: case 0: - if (chunk == 0 || chunk == UnSet) + if (chunk == 0 || chunk == UnSet) { + chunk = UnSet; do_default_chunk = 1; /* chunk will be set later */ + } break; case LEVEL_LINEAR: /* a chunksize of zero 0s perfectly valid (and preferred) since 2.6.16 */ @@ -257,12 +259,17 @@ int Create(struct supertype *st, char *mddev, return 1; } - if (size && chunk) + if (size && chunk && chunk != UnSet) size &= ~(unsigned long long)(chunk - 1); newsize = size * 2; if (st && ! st->ss->validate_geometry(st, level, layout, raiddisks, &chunk, size*2, NULL, &newsize, verbose>=0)) return 1; + + if (chunk) { + newsize &= ~(unsigned long long)(chunk*2 - 1); + size &= ~(unsigned long long)(chunk - 1); + } if (size == 0) { size = newsize / 2; if (size && verbose > 0) |