This call to validate_geometry is really rather gratuitous.
It is purely about the fact that super0 cannot use more than 4TB.
So just make it an explicit test - less confusing that way.
With this, validate_geometry is only called from Create, which
makes it easier to reason about.
Also validate_geometry is now never passed NULL for the 'chunk'
parameter, so we can remove those annoying tests for NULL.
Signed-off-by: NeilBrown <neilb@suse.de>
return -1;
}
- if (tst->ss->validate_geometry(
- tst, array->level, array->layout,
- array->raid_disks, NULL,
- ldsize >> 9, INVALID_SECTORS, NULL, NULL, 0) == 0) {
+ if (tst->ss == &super0 && ldsize > 4ULL*1024*1024*2) {
+ /* More than 4TB is wasted on v0.90 */
if (!force) {
pr_err("%s is larger than %s can "
"effectively use.\n"
* If given BVDs, we make an SVD, changing all the GUIDs in the process.
*/
- if (chunk && *chunk == UnSet)
+ if (*chunk == UnSet)
*chunk = DEFAULT_CHUNK;
if (level == -1000000) level = LEVEL_CONTAINER;
if (level == LEVEL_CONTAINER) {
/* Must be a fresh device to add to a container */
return validate_geometry_ddf_container(st, level, layout,
- raiddisks, chunk?*chunk:0,
+ raiddisks, *chunk,
size, data_offset, dev,
freesize,
verbose);
* chosen so that add_to_super/getinfo_super
* can return them.
*/
- return reserve_space(st, raiddisks, size, chunk?*chunk:0, freesize);
+ return reserve_space(st, raiddisks, size, *chunk, freesize);
}
return 1;
}
return 0;
}
- if (chunk && (*chunk == 0 || *chunk == UnSet))
+ if (*chunk == 0 || *chunk == UnSet)
*chunk = imsm_default_chunk(super->orom);
- if (super->orom && chunk && !imsm_orom_has_chunk(super->orom, *chunk)) {
+ if (super->orom && !imsm_orom_has_chunk(super->orom, *chunk)) {
pr_vrb(": platform does not support a chunk size of: "
"%d\n", *chunk);
return 0;
return 0;
}
- if (super->orom && (super->orom->attr & IMSM_OROM_ATTR_2TB) == 0 && chunk &&
+ if (super->orom && (super->orom->attr & IMSM_OROM_ATTR_2TB) == 0 &&
(calc_array_size(level, raiddisks, layout, *chunk, size) >> 32) > 0) {
pr_vrb(": platform does not support a volume size over 2TB\n");
return 0;
/* Must be a fresh device to add to a container */
return validate_geometry_imsm_container(st, level, layout,
raiddisks,
- chunk?*chunk:0,
+ *chunk,
size, data_offset,
dev, freesize,
verbose);
}
if (freesize)
return reserve_space(st, raiddisks, size,
- chunk?*chunk:0, freesize);
+ *chunk, freesize);
}
return 1;
}
"%d terabytes per device\n", tbmax);
return 0;
}
- if (chunk && *chunk == UnSet)
+ if (*chunk == UnSet)
*chunk = DEFAULT_CHUNK;
if (!subdev)
pr_err("1.x metadata does not support containers\n");
return 0;
}
- if (chunk && *chunk == UnSet)
+ if (*chunk == UnSet)
*chunk = DEFAULT_CHUNK;
if (!subdev)