aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 5d88329e3c7a..3cb0872a845d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1402,6 +1402,9 @@ static void raid1d(mddev_t *mddev)
1402 clear_bit(R1BIO_BarrierRetry, &r1_bio->state); 1402 clear_bit(R1BIO_BarrierRetry, &r1_bio->state);
1403 clear_bit(R1BIO_Barrier, &r1_bio->state); 1403 clear_bit(R1BIO_Barrier, &r1_bio->state);
1404 for (i=0; i < conf->raid_disks; i++) 1404 for (i=0; i < conf->raid_disks; i++)
1405 if (r1_bio->bios[i])
1406 atomic_inc(&r1_bio->remaining);
1407 for (i=0; i < conf->raid_disks; i++)
1405 if (r1_bio->bios[i]) { 1408 if (r1_bio->bios[i]) {
1406 struct bio_vec *bvec; 1409 struct bio_vec *bvec;
1407 int j; 1410 int j;
@@ -1789,6 +1792,11 @@ static int run(mddev_t *mddev)
1789 mdname(mddev), mddev->level); 1792 mdname(mddev), mddev->level);
1790 goto out; 1793 goto out;
1791 } 1794 }
1795 if (mddev->reshape_position != MaxSector) {
1796 printk("raid1: %s: reshape_position set but not supported\n",
1797 mdname(mddev));
1798 goto out;
1799 }
1792 /* 1800 /*
1793 * copy the already verified devices into our private RAID1 1801 * copy the already verified devices into our private RAID1
1794 * bookkeeping area. [whatever we allocate in run(), 1802 * bookkeeping area. [whatever we allocate in run(),
@@ -1971,7 +1979,7 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
1971 return 0; 1979 return 0;
1972} 1980}
1973 1981
1974static int raid1_reshape(mddev_t *mddev, int raid_disks) 1982static int raid1_reshape(mddev_t *mddev)
1975{ 1983{
1976 /* We need to: 1984 /* We need to:
1977 * 1/ resize the r1bio_pool 1985 * 1/ resize the r1bio_pool
@@ -1988,10 +1996,22 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
1988 struct pool_info *newpoolinfo; 1996 struct pool_info *newpoolinfo;
1989 mirror_info_t *newmirrors; 1997 mirror_info_t *newmirrors;
1990 conf_t *conf = mddev_to_conf(mddev); 1998 conf_t *conf = mddev_to_conf(mddev);
1991 int cnt; 1999 int cnt, raid_disks;
1992 2000
1993 int d, d2; 2001 int d, d2;
1994 2002
2003 /* Cannot change chunk_size, layout, or level */
2004 if (mddev->chunk_size != mddev->new_chunk ||
2005 mddev->layout != mddev->new_layout ||
2006 mddev->level != mddev->new_level) {
2007 mddev->new_chunk = mddev->chunk_size;
2008 mddev->new_layout = mddev->layout;
2009 mddev->new_level = mddev->level;
2010 return -EINVAL;
2011 }
2012
2013 raid_disks = mddev->raid_disks + mddev->delta_disks;
2014
1995 if (raid_disks < conf->raid_disks) { 2015 if (raid_disks < conf->raid_disks) {
1996 cnt=0; 2016 cnt=0;
1997 for (d= 0; d < conf->raid_disks; d++) 2017 for (d= 0; d < conf->raid_disks; d++)
@@ -2038,6 +2058,7 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
2038 2058
2039 mddev->degraded += (raid_disks - conf->raid_disks); 2059 mddev->degraded += (raid_disks - conf->raid_disks);
2040 conf->raid_disks = mddev->raid_disks = raid_disks; 2060 conf->raid_disks = mddev->raid_disks = raid_disks;
2061 mddev->delta_disks = 0;
2041 2062
2042 conf->last_used = 0; /* just make sure it is in-range */ 2063 conf->last_used = 0; /* just make sure it is in-range */
2043 lower_barrier(conf); 2064 lower_barrier(conf);
@@ -2079,7 +2100,7 @@ static struct mdk_personality raid1_personality =
2079 .spare_active = raid1_spare_active, 2100 .spare_active = raid1_spare_active,
2080 .sync_request = sync_request, 2101 .sync_request = sync_request,
2081 .resize = raid1_resize, 2102 .resize = raid1_resize,
2082 .reshape = raid1_reshape, 2103 .check_reshape = raid1_reshape,
2083 .quiesce = raid1_quiesce, 2104 .quiesce = raid1_quiesce,
2084}; 2105};
2085 2106