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 */
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)
* If given BVDs, we make an SVD, changing all the GUIDs in the process.
*/
+ if (chunk && *chunk == UnSet)
+ *chunk = DEFAULT_CHUNK;
+
+
if (level == LEVEL_CONTAINER) {
/* Must be a fresh device to add to a container */
return validate_geometry_ddf_container(st, level, layout,
if (!ddf)
return 0;
- if (chunk && (*chunk == 0 || *chunk == UnSet))
- *chunk = DEFAULT_CHUNK;
-
if (!dev) {
/* General test: make sure there is space for
* 'raiddisks' device extents of size 'size'.
fprintf(stderr, Name ": 0.90 metadata supports at most 2 terrabytes per device\n");
return 0;
}
+ if (chunk && *chunk == UnSet)
+ *chunk = DEFAULT_CHUNK;
+
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)
fprintf(stderr, Name ": 1.x metadata does not support containers\n");
return 0;
}
+ if (chunk && *chunk == UnSet)
+ *chunk = DEFAULT_CHUNK;
+
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)