aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-03-30 23:39:38 -0400
committerNeilBrown <neilb@suse.de>2009-03-30 23:39:38 -0400
commit34817e8c3948ea20316dfa8fd8947d6d0ee82ba9 (patch)
treef4d2e75473b46db94928e21e9fe54b029432418b /drivers/md
parent67cc2b8165857ba019920d1f00d64bcc4140075d (diff)
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')
-rw-r--r--drivers/md/md.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 07ab6790e29d..117ea5fde568 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)
2633 2633
2634 if (mddev->pers) 2634 if (mddev->pers)
2635 return -EBUSY; 2635 return -EBUSY;
2636 if (mddev->reshape_position != MaxSector) 2636
2637 mddev->new_layout = n; 2637 mddev->new_layout = n;
2638 else 2638 if (mddev->reshape_position == MaxSector)
2639 mddev->layout = n; 2639 mddev->layout = n;
2640 return len; 2640 return len;
2641} 2641}
@@ -2702,9 +2702,9 @@ chunk_size_store(mddev_t *mddev, const char *buf, size_t len)
2702 2702
2703 if (mddev->pers) 2703 if (mddev->pers)
2704 return -EBUSY; 2704 return -EBUSY;
2705 else if (mddev->reshape_position != MaxSector) 2705
2706 mddev->new_chunk = n; 2706 mddev->new_chunk = n;
2707 else 2707 if (mddev->reshape_position == MaxSector)
2708 mddev->chunk_size = n; 2708 mddev->chunk_size = n;
2709 return len; 2709 return len;
2710} 2710}
@@ -3831,7 +3831,10 @@ static int do_md_run(mddev_t * mddev)
3831 } 3831 }
3832 mddev->pers = pers; 3832 mddev->pers = pers;
3833 spin_unlock(&pers_lock); 3833 spin_unlock(&pers_lock);
3834 mddev->level = pers->level; 3834 if (mddev->level != pers->level) {
3835 mddev->level = pers->level;
3836 mddev->new_level = pers->level;
3837 }
3835 strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel)); 3838 strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel));
3836 3839
3837 if (pers->level >= 4 && pers->level <= 6) 3840 if (pers->level >= 4 && pers->level <= 6)