When an md array is undergoing a change, we have new_* fields that
show the new values.
When no change is happening, it is least confusing if these have
the same value as the normal fields.
This is true in most cases, but not when the values are set via sysfs.
So fix this up.
A subsequent patch will BUG_ON if these things aren't consistent.
Signed-off-by: NeilBrown <neilb@suse.de>
if (mddev->pers)
return -EBUSY;
- if (mddev->reshape_position != MaxSector)
- mddev->new_layout = n;
- else
+
+ mddev->new_layout = n;
+ if (mddev->reshape_position == MaxSector)
mddev->layout = n;
return len;
}
if (mddev->pers)
return -EBUSY;
- else if (mddev->reshape_position != MaxSector)
- mddev->new_chunk = n;
- else
+
+ mddev->new_chunk = n;
+ if (mddev->reshape_position == MaxSector)
mddev->chunk_size = n;
return len;
}
}
mddev->pers = pers;
spin_unlock(&pers_lock);
- mddev->level = pers->level;
+ if (mddev->level != pers->level) {
+ mddev->level = pers->level;
+ mddev->new_level = pers->level;
+ }
strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel));
if (pers->level >= 4 && pers->level <= 6)