aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-09-08 20:55:21 -0400
committerDan Williams <dan.j.williams@intel.com>2009-09-08 20:55:21 -0400
commitbbb20089a3275a19e475dbc21320c3742e3ca423 (patch)
tree216fdc1cbef450ca688135c5b8969169482d9a48 /drivers/md/raid1.c
parent3e48e656903e9fd8bc805c6a2c4264d7808d315b (diff)
parent657a77fa7284d8ae28dfa48f1dc5d919bf5b2843 (diff)
Merge branch 'dmaengine' into async-tx-next
Conflicts: crypto/async_tx/async_xor.c drivers/dma/ioat/dma_v2.h drivers/dma/ioat/pci.c drivers/md/raid5.c
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 36df9109cde1..89939a7aef57 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -182,7 +182,7 @@ static void put_all_bios(conf_t *conf, r1bio_t *r1_bio)
182 182
183static void free_r1bio(r1bio_t *r1_bio) 183static void free_r1bio(r1bio_t *r1_bio)
184{ 184{
185 conf_t *conf = mddev_to_conf(r1_bio->mddev); 185 conf_t *conf = r1_bio->mddev->private;
186 186
187 /* 187 /*
188 * Wake up any possible resync thread that waits for the device 188 * Wake up any possible resync thread that waits for the device
@@ -196,7 +196,7 @@ static void free_r1bio(r1bio_t *r1_bio)
196 196
197static void put_buf(r1bio_t *r1_bio) 197static void put_buf(r1bio_t *r1_bio)
198{ 198{
199 conf_t *conf = mddev_to_conf(r1_bio->mddev); 199 conf_t *conf = r1_bio->mddev->private;
200 int i; 200 int i;
201 201
202 for (i=0; i<conf->raid_disks; i++) { 202 for (i=0; i<conf->raid_disks; i++) {
@@ -214,7 +214,7 @@ static void reschedule_retry(r1bio_t *r1_bio)
214{ 214{
215 unsigned long flags; 215 unsigned long flags;
216 mddev_t *mddev = r1_bio->mddev; 216 mddev_t *mddev = r1_bio->mddev;
217 conf_t *conf = mddev_to_conf(mddev); 217 conf_t *conf = mddev->private;
218 218
219 spin_lock_irqsave(&conf->device_lock, flags); 219 spin_lock_irqsave(&conf->device_lock, flags);
220 list_add(&r1_bio->retry_list, &conf->retry_list); 220 list_add(&r1_bio->retry_list, &conf->retry_list);
@@ -253,7 +253,7 @@ static void raid_end_bio_io(r1bio_t *r1_bio)
253 */ 253 */
254static inline void update_head_pos(int disk, r1bio_t *r1_bio) 254static inline void update_head_pos(int disk, r1bio_t *r1_bio)
255{ 255{
256 conf_t *conf = mddev_to_conf(r1_bio->mddev); 256 conf_t *conf = r1_bio->mddev->private;
257 257
258 conf->mirrors[disk].head_position = 258 conf->mirrors[disk].head_position =
259 r1_bio->sector + (r1_bio->sectors); 259 r1_bio->sector + (r1_bio->sectors);
@@ -264,7 +264,7 @@ static void raid1_end_read_request(struct bio *bio, int error)
264 int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 264 int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
265 r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); 265 r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
266 int mirror; 266 int mirror;
267 conf_t *conf = mddev_to_conf(r1_bio->mddev); 267 conf_t *conf = r1_bio->mddev->private;
268 268
269 mirror = r1_bio->read_disk; 269 mirror = r1_bio->read_disk;
270 /* 270 /*
@@ -309,7 +309,7 @@ static void raid1_end_write_request(struct bio *bio, int error)
309 int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 309 int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
310 r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); 310 r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
311 int mirror, behind = test_bit(R1BIO_BehindIO, &r1_bio->state); 311 int mirror, behind = test_bit(R1BIO_BehindIO, &r1_bio->state);
312 conf_t *conf = mddev_to_conf(r1_bio->mddev); 312 conf_t *conf = r1_bio->mddev->private;
313 struct bio *to_put = NULL; 313 struct bio *to_put = NULL;
314 314
315 315
@@ -541,7 +541,7 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio)
541 541
542static void unplug_slaves(mddev_t *mddev) 542static void unplug_slaves(mddev_t *mddev)
543{ 543{
544 conf_t *conf = mddev_to_conf(mddev); 544 conf_t *conf = mddev->private;
545 int i; 545 int i;
546 546
547 rcu_read_lock(); 547 rcu_read_lock();
@@ -573,7 +573,7 @@ static void raid1_unplug(struct request_queue *q)
573static int raid1_congested(void *data, int bits) 573static int raid1_congested(void *data, int bits)
574{ 574{
575 mddev_t *mddev = data; 575 mddev_t *mddev = data;
576 conf_t *conf = mddev_to_conf(mddev); 576 conf_t *conf = mddev->private;
577 int i, ret = 0; 577 int i, ret = 0;
578 578
579 rcu_read_lock(); 579 rcu_read_lock();
@@ -772,7 +772,7 @@ do_sync_io:
772static int make_request(struct request_queue *q, struct bio * bio) 772static int make_request(struct request_queue *q, struct bio * bio)
773{ 773{
774 mddev_t *mddev = q->queuedata; 774 mddev_t *mddev = q->queuedata;
775 conf_t *conf = mddev_to_conf(mddev); 775 conf_t *conf = mddev->private;
776 mirror_info_t *mirror; 776 mirror_info_t *mirror;
777 r1bio_t *r1_bio; 777 r1bio_t *r1_bio;
778 struct bio *read_bio; 778 struct bio *read_bio;
@@ -991,7 +991,7 @@ static int make_request(struct request_queue *q, struct bio * bio)
991 991
992static void status(struct seq_file *seq, mddev_t *mddev) 992static void status(struct seq_file *seq, mddev_t *mddev)
993{ 993{
994 conf_t *conf = mddev_to_conf(mddev); 994 conf_t *conf = mddev->private;
995 int i; 995 int i;
996 996
997 seq_printf(seq, " [%d/%d] [", conf->raid_disks, 997 seq_printf(seq, " [%d/%d] [", conf->raid_disks,
@@ -1010,7 +1010,7 @@ static void status(struct seq_file *seq, mddev_t *mddev)
1010static void error(mddev_t *mddev, mdk_rdev_t *rdev) 1010static void error(mddev_t *mddev, mdk_rdev_t *rdev)
1011{ 1011{
1012 char b[BDEVNAME_SIZE]; 1012 char b[BDEVNAME_SIZE];
1013 conf_t *conf = mddev_to_conf(mddev); 1013 conf_t *conf = mddev->private;
1014 1014
1015 /* 1015 /*
1016 * If it is not operational, then we have already marked it as dead 1016 * If it is not operational, then we have already marked it as dead
@@ -1130,7 +1130,7 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
1130 * a one page request is never in violation. 1130 * a one page request is never in violation.
1131 */ 1131 */
1132 if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 1132 if (rdev->bdev->bd_disk->queue->merge_bvec_fn &&
1133 mddev->queue->max_sectors > (PAGE_SIZE>>9)) 1133 queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9))
1134 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); 1134 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);
1135 1135
1136 p->head_position = 0; 1136 p->head_position = 0;
@@ -1214,7 +1214,7 @@ static void end_sync_write(struct bio *bio, int error)
1214 int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 1214 int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
1215 r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); 1215 r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
1216 mddev_t *mddev = r1_bio->mddev; 1216 mddev_t *mddev = r1_bio->mddev;
1217 conf_t *conf = mddev_to_conf(mddev); 1217 conf_t *conf = mddev->private;
1218 int i; 1218 int i;
1219 int mirror=0; 1219 int mirror=0;
1220 1220
@@ -1248,7 +1248,7 @@ static void end_sync_write(struct bio *bio, int error)
1248 1248
1249static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) 1249static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1250{ 1250{
1251 conf_t *conf = mddev_to_conf(mddev); 1251 conf_t *conf = mddev->private;
1252 int i; 1252 int i;
1253 int disks = conf->raid_disks; 1253 int disks = conf->raid_disks;
1254 struct bio *bio, *wbio; 1254 struct bio *bio, *wbio;
@@ -1562,7 +1562,7 @@ static void raid1d(mddev_t *mddev)
1562 r1bio_t *r1_bio; 1562 r1bio_t *r1_bio;
1563 struct bio *bio; 1563 struct bio *bio;
1564 unsigned long flags; 1564 unsigned long flags;
1565 conf_t *conf = mddev_to_conf(mddev); 1565 conf_t *conf = mddev->private;
1566 struct list_head *head = &conf->retry_list; 1566 struct list_head *head = &conf->retry_list;
1567 int unplug=0; 1567 int unplug=0;
1568 mdk_rdev_t *rdev; 1568 mdk_rdev_t *rdev;
@@ -1585,7 +1585,7 @@ static void raid1d(mddev_t *mddev)
1585 spin_unlock_irqrestore(&conf->device_lock, flags); 1585 spin_unlock_irqrestore(&conf->device_lock, flags);
1586 1586
1587 mddev = r1_bio->mddev; 1587 mddev = r1_bio->mddev;
1588 conf = mddev_to_conf(mddev); 1588 conf = mddev->private;
1589 if (test_bit(R1BIO_IsSync, &r1_bio->state)) { 1589 if (test_bit(R1BIO_IsSync, &r1_bio->state)) {
1590 sync_request_write(mddev, r1_bio); 1590 sync_request_write(mddev, r1_bio);
1591 unplug = 1; 1591 unplug = 1;
@@ -1706,7 +1706,7 @@ static int init_resync(conf_t *conf)
1706 1706
1707static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster) 1707static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
1708{ 1708{
1709 conf_t *conf = mddev_to_conf(mddev); 1709 conf_t *conf = mddev->private;
1710 r1bio_t *r1_bio; 1710 r1bio_t *r1_bio;
1711 struct bio *bio; 1711 struct bio *bio;
1712 sector_t max_sector, nr_sectors; 1712 sector_t max_sector, nr_sectors;
@@ -1996,7 +1996,7 @@ static int run(mddev_t *mddev)
1996 * a one page request is never in violation. 1996 * a one page request is never in violation.
1997 */ 1997 */
1998 if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 1998 if (rdev->bdev->bd_disk->queue->merge_bvec_fn &&
1999 mddev->queue->max_sectors > (PAGE_SIZE>>9)) 1999 queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9))
2000 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); 2000 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);
2001 2001
2002 disk->head_position = 0; 2002 disk->head_position = 0;
@@ -2052,6 +2052,10 @@ static int run(mddev_t *mddev)
2052 goto out_free_conf; 2052 goto out_free_conf;
2053 } 2053 }
2054 2054
2055 if (mddev->recovery_cp != MaxSector)
2056 printk(KERN_NOTICE "raid1: %s is not clean"
2057 " -- starting background reconstruction\n",
2058 mdname(mddev));
2055 printk(KERN_INFO 2059 printk(KERN_INFO
2056 "raid1: raid set %s active with %d out of %d mirrors\n", 2060 "raid1: raid set %s active with %d out of %d mirrors\n",
2057 mdname(mddev), mddev->raid_disks - mddev->degraded, 2061 mdname(mddev), mddev->raid_disks - mddev->degraded,
@@ -2087,7 +2091,7 @@ out:
2087 2091
2088static int stop(mddev_t *mddev) 2092static int stop(mddev_t *mddev)
2089{ 2093{
2090 conf_t *conf = mddev_to_conf(mddev); 2094 conf_t *conf = mddev->private;
2091 struct bitmap *bitmap = mddev->bitmap; 2095 struct bitmap *bitmap = mddev->bitmap;
2092 int behind_wait = 0; 2096 int behind_wait = 0;
2093 2097
@@ -2155,16 +2159,16 @@ static int raid1_reshape(mddev_t *mddev)
2155 mempool_t *newpool, *oldpool; 2159 mempool_t *newpool, *oldpool;
2156 struct pool_info *newpoolinfo; 2160 struct pool_info *newpoolinfo;
2157 mirror_info_t *newmirrors; 2161 mirror_info_t *newmirrors;
2158 conf_t *conf = mddev_to_conf(mddev); 2162 conf_t *conf = mddev->private;
2159 int cnt, raid_disks; 2163 int cnt, raid_disks;
2160 unsigned long flags; 2164 unsigned long flags;
2161 int d, d2, err; 2165 int d, d2, err;
2162 2166
2163 /* Cannot change chunk_size, layout, or level */ 2167 /* Cannot change chunk_size, layout, or level */
2164 if (mddev->chunk_size != mddev->new_chunk || 2168 if (mddev->chunk_sectors != mddev->new_chunk_sectors ||
2165 mddev->layout != mddev->new_layout || 2169 mddev->layout != mddev->new_layout ||
2166 mddev->level != mddev->new_level) { 2170 mddev->level != mddev->new_level) {
2167 mddev->new_chunk = mddev->chunk_size; 2171 mddev->new_chunk_sectors = mddev->chunk_sectors;
2168 mddev->new_layout = mddev->layout; 2172 mddev->new_layout = mddev->layout;
2169 mddev->new_level = mddev->level; 2173 mddev->new_level = mddev->level;
2170 return -EINVAL; 2174 return -EINVAL;
@@ -2252,7 +2256,7 @@ static int raid1_reshape(mddev_t *mddev)
2252 2256
2253static void raid1_quiesce(mddev_t *mddev, int state) 2257static void raid1_quiesce(mddev_t *mddev, int state)
2254{ 2258{
2255 conf_t *conf = mddev_to_conf(mddev); 2259 conf_t *conf = mddev->private;
2256 2260
2257 switch(state) { 2261 switch(state) {
2258 case 1: 2262 case 1: