[PATCH] md: Split reshape handler in check_reshape and start_reshape
check_reshape checks validity and does things that can be done instantly - like adding devices to raid1. start_reshape initiates a restriping process to convert the whole array. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
b578d55fdd
commit
63c70c4f3a
@@ -1976,7 +1976,7 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int raid1_reshape(mddev_t *mddev, int raid_disks)
|
||||
static int raid1_reshape(mddev_t *mddev)
|
||||
{
|
||||
/* We need to:
|
||||
* 1/ resize the r1bio_pool
|
||||
@@ -1993,10 +1993,22 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
|
||||
struct pool_info *newpoolinfo;
|
||||
mirror_info_t *newmirrors;
|
||||
conf_t *conf = mddev_to_conf(mddev);
|
||||
int cnt;
|
||||
int cnt, raid_disks;
|
||||
|
||||
int d, d2;
|
||||
|
||||
/* Cannot change chunk_size, layout, or level */
|
||||
if (mddev->chunk_size != mddev->new_chunk ||
|
||||
mddev->layout != mddev->new_layout ||
|
||||
mddev->level != mddev->new_level) {
|
||||
mddev->new_chunk = mddev->chunk_size;
|
||||
mddev->new_layout = mddev->layout;
|
||||
mddev->new_level = mddev->level;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
raid_disks = mddev->raid_disks + mddev->delta_disks;
|
||||
|
||||
if (raid_disks < conf->raid_disks) {
|
||||
cnt=0;
|
||||
for (d= 0; d < conf->raid_disks; d++)
|
||||
@@ -2043,6 +2055,7 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
|
||||
|
||||
mddev->degraded += (raid_disks - conf->raid_disks);
|
||||
conf->raid_disks = mddev->raid_disks = raid_disks;
|
||||
mddev->delta_disks = 0;
|
||||
|
||||
conf->last_used = 0; /* just make sure it is in-range */
|
||||
lower_barrier(conf);
|
||||
@@ -2084,7 +2097,7 @@ static struct mdk_personality raid1_personality =
|
||||
.spare_active = raid1_spare_active,
|
||||
.sync_request = sync_request,
|
||||
.resize = raid1_resize,
|
||||
.reshape = raid1_reshape,
|
||||
.check_reshape = raid1_reshape,
|
||||
.quiesce = raid1_quiesce,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user