aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-03-27 04:18:13 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:45:02 -0500
commit63c70c4f3a30e77e6f445bd16eff7934a031ebd3 (patch)
tree12d2cd6cec5cd304bdf514ec8999a44c26f058ae /drivers/md/raid1.c
parentb578d55fdd80140f657130abd85aebeb345755fb (diff)
[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>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index b65b8cfbdf30..04418e10d1dc 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1976,7 +1976,7 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
1976 return 0; 1976 return 0;
1977} 1977}
1978 1978
1979static int raid1_reshape(mddev_t *mddev, int raid_disks) 1979static int raid1_reshape(mddev_t *mddev)
1980{ 1980{
1981 /* We need to: 1981 /* We need to:
1982 * 1/ resize the r1bio_pool 1982 * 1/ resize the r1bio_pool
@@ -1993,10 +1993,22 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
1993 struct pool_info *newpoolinfo; 1993 struct pool_info *newpoolinfo;
1994 mirror_info_t *newmirrors; 1994 mirror_info_t *newmirrors;
1995 conf_t *conf = mddev_to_conf(mddev); 1995 conf_t *conf = mddev_to_conf(mddev);
1996 int cnt; 1996 int cnt, raid_disks;
1997 1997
1998 int d, d2; 1998 int d, d2;
1999 1999
2000 /* Cannot change chunk_size, layout, or level */
2001 if (mddev->chunk_size != mddev->new_chunk ||
2002 mddev->layout != mddev->new_layout ||
2003 mddev->level != mddev->new_level) {
2004 mddev->new_chunk = mddev->chunk_size;
2005 mddev->new_layout = mddev->layout;
2006 mddev->new_level = mddev->level;
2007 return -EINVAL;
2008 }
2009
2010 raid_disks = mddev->raid_disks + mddev->delta_disks;
2011
2000 if (raid_disks < conf->raid_disks) { 2012 if (raid_disks < conf->raid_disks) {
2001 cnt=0; 2013 cnt=0;
2002 for (d= 0; d < conf->raid_disks; d++) 2014 for (d= 0; d < conf->raid_disks; d++)
@@ -2043,6 +2055,7 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
2043 2055
2044 mddev->degraded += (raid_disks - conf->raid_disks); 2056 mddev->degraded += (raid_disks - conf->raid_disks);
2045 conf->raid_disks = mddev->raid_disks = raid_disks; 2057 conf->raid_disks = mddev->raid_disks = raid_disks;
2058 mddev->delta_disks = 0;
2046 2059
2047 conf->last_used = 0; /* just make sure it is in-range */ 2060 conf->last_used = 0; /* just make sure it is in-range */
2048 lower_barrier(conf); 2061 lower_barrier(conf);
@@ -2084,7 +2097,7 @@ static struct mdk_personality raid1_personality =
2084 .spare_active = raid1_spare_active, 2097 .spare_active = raid1_spare_active,
2085 .sync_request = sync_request, 2098 .sync_request = sync_request,
2086 .resize = raid1_resize, 2099 .resize = raid1_resize,
2087 .reshape = raid1_reshape, 2100 .check_reshape = raid1_reshape,
2088 .quiesce = raid1_quiesce, 2101 .quiesce = raid1_quiesce,
2089}; 2102};
2090 2103