Manage: remove call to validate_geometry.
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>
This commit is contained in:
parent
0c78849f2b
commit
7ccc4cc4fc
6
Manage.c
6
Manage.c
|
@ -718,10 +718,8 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|||
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"
|
||||
|
|
|
@ -3185,14 +3185,14 @@ static int validate_geometry_ddf(struct supertype *st,
|
|||
* 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);
|
||||
|
@ -3220,7 +3220,7 @@ static int validate_geometry_ddf(struct supertype *st,
|
|||
* 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;
|
||||
}
|
||||
|
|
|
@ -5854,10 +5854,10 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
|
|||
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;
|
||||
|
@ -5874,7 +5874,7 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
|
|||
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;
|
||||
|
@ -6188,7 +6188,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
|||
/* 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);
|
||||
|
@ -6224,7 +6224,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
|||
}
|
||||
if (freesize)
|
||||
return reserve_space(st, raiddisks, size,
|
||||
chunk?*chunk:0, freesize);
|
||||
*chunk, freesize);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
2
super0.c
2
super0.c
|
@ -1274,7 +1274,7 @@ static int validate_geometry0(struct supertype *st, int level,
|
|||
"%d terabytes per device\n", tbmax);
|
||||
return 0;
|
||||
}
|
||||
if (chunk && *chunk == UnSet)
|
||||
if (*chunk == UnSet)
|
||||
*chunk = DEFAULT_CHUNK;
|
||||
|
||||
if (!subdev)
|
||||
|
|
Loading…
Reference in New Issue