diff options
author | NeilBrown <neilb@suse.de> | 2009-03-31 14:39:38 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-03-31 14:39:38 +1100 |
commit | 34817e8c3948ea20316dfa8fd8947d6d0ee82ba9 (patch) | |
tree | f4d2e75473b46db94928e21e9fe54b029432418b /drivers/md/md.c | |
parent | 67cc2b8165857ba019920d1f00d64bcc4140075d (diff) | |
download | kernel-crypto-34817e8c3948ea20316dfa8fd8947d6d0ee82ba9.tar.gz kernel-crypto-34817e8c3948ea20316dfa8fd8947d6d0ee82ba9.tar.xz kernel-crypto-34817e8c3948ea20316dfa8fd8947d6d0ee82ba9.zip |
md: make sure new_level, new_chunksize, new_layout always have sensible values.
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>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 07ab6790e29..117ea5fde56 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2633,9 +2633,9 @@ layout_store(mddev_t *mddev, const char *buf, size_t len) 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; } @@ -2702,9 +2702,9 @@ chunk_size_store(mddev_t *mddev, const char *buf, size_t 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; } @@ -3831,7 +3831,10 @@ static int do_md_run(mddev_t * mddev) } 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) |