revert-reshape: only impose reshape_position tests on raid[456]
This test is irrelevant for RAID10, so restrict it to those levels in which it is meaningful. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
4bffc964b9
commit
efb3994e48
5
super0.c
5
super0.c
|
@ -650,14 +650,15 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
|
||||||
pr_err("No active reshape to revert on %s\n",
|
pr_err("No active reshape to revert on %s\n",
|
||||||
devname);
|
devname);
|
||||||
else if (sb->delta_disks == 0)
|
else if (sb->delta_disks == 0)
|
||||||
pr_err("%s: Can on revert reshape which changes number of devices\n",
|
pr_err("%s: Can only revert reshape which changes number of devices\n",
|
||||||
devname);
|
devname);
|
||||||
else {
|
else {
|
||||||
int tmp;
|
int tmp;
|
||||||
int parity = sb->level == 6 ? 2 : 1;
|
int parity = sb->level == 6 ? 2 : 1;
|
||||||
rv = 0;
|
rv = 0;
|
||||||
|
|
||||||
if (sb->reshape_position % (
|
if (sb->level >= 4 && sb->level <= 6 &&
|
||||||
|
sb->reshape_position % (
|
||||||
sb->new_chunk/512 *
|
sb->new_chunk/512 *
|
||||||
(sb->raid_disks - sb->delta_disks - parity))) {
|
(sb->raid_disks - sb->delta_disks - parity))) {
|
||||||
pr_err("Reshape position is not suitably aligned.\n");
|
pr_err("Reshape position is not suitably aligned.\n");
|
||||||
|
|
19
super1.c
19
super1.c
|
@ -1276,14 +1276,17 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
||||||
* So we reject a revert-reshape unless the
|
* So we reject a revert-reshape unless the
|
||||||
* alignment is good.
|
* alignment is good.
|
||||||
*/
|
*/
|
||||||
reshape_sectors = __le64_to_cpu(sb->reshape_position);
|
if (__le32_to_cpu(sb->level) >= 4 &&
|
||||||
reshape_chunk = __le32_to_cpu(sb->new_chunk);
|
__le32_to_cpu(sb->level) <= 6) {
|
||||||
reshape_chunk *= __le32_to_cpu(sb->raid_disks) - __le32_to_cpu(sb->delta_disks) -
|
reshape_sectors = __le64_to_cpu(sb->reshape_position);
|
||||||
(__le32_to_cpu(sb->level)==6 ? 2 : 1);
|
reshape_chunk = __le32_to_cpu(sb->new_chunk);
|
||||||
if (reshape_sectors % reshape_chunk) {
|
reshape_chunk *= __le32_to_cpu(sb->raid_disks) - __le32_to_cpu(sb->delta_disks) -
|
||||||
pr_err("Reshape position is not suitably aligned.\n");
|
(__le32_to_cpu(sb->level)==6 ? 2 : 1);
|
||||||
pr_err("Try normal assembly as stop again\n");
|
if (reshape_sectors % reshape_chunk) {
|
||||||
return -2;
|
pr_err("Reshape position is not suitably aligned.\n");
|
||||||
|
pr_err("Try normal assembly as stop again\n");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sb->raid_disks = __cpu_to_le32(__le32_to_cpu(sb->raid_disks) -
|
sb->raid_disks = __cpu_to_le32(__le32_to_cpu(sb->raid_disks) -
|
||||||
__le32_to_cpu(sb->delta_disks));
|
__le32_to_cpu(sb->delta_disks));
|
||||||
|
|
Loading…
Reference in New Issue