aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 99ae6068e456..8da6282254c3 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1039,7 +1039,6 @@ static void make_request(struct mddev *mddev, struct bio * bio)
1039 const unsigned long do_fua = (bio->bi_rw & REQ_FUA); 1039 const unsigned long do_fua = (bio->bi_rw & REQ_FUA);
1040 unsigned long flags; 1040 unsigned long flags;
1041 struct md_rdev *blocked_rdev; 1041 struct md_rdev *blocked_rdev;
1042 int plugged;
1043 int sectors_handled; 1042 int sectors_handled;
1044 int max_sectors; 1043 int max_sectors;
1045 int sectors; 1044 int sectors;
@@ -1239,7 +1238,6 @@ read_again:
1239 * of r10_bios is recored in bio->bi_phys_segments just as with 1238 * of r10_bios is recored in bio->bi_phys_segments just as with
1240 * the read case. 1239 * the read case.
1241 */ 1240 */
1242 plugged = mddev_check_plugged(mddev);
1243 1241
1244 r10_bio->read_slot = -1; /* make sure repl_bio gets freed */ 1242 r10_bio->read_slot = -1; /* make sure repl_bio gets freed */
1245 raid10_find_phys(conf, r10_bio); 1243 raid10_find_phys(conf, r10_bio);
@@ -1396,6 +1394,8 @@ retry_write:
1396 bio_list_add(&conf->pending_bio_list, mbio); 1394 bio_list_add(&conf->pending_bio_list, mbio);
1397 conf->pending_count++; 1395 conf->pending_count++;
1398 spin_unlock_irqrestore(&conf->device_lock, flags); 1396 spin_unlock_irqrestore(&conf->device_lock, flags);
1397 if (!mddev_check_plugged(mddev))
1398 md_wakeup_thread(mddev->thread);
1399 1399
1400 if (!r10_bio->devs[i].repl_bio) 1400 if (!r10_bio->devs[i].repl_bio)
1401 continue; 1401 continue;
@@ -1423,6 +1423,8 @@ retry_write:
1423 bio_list_add(&conf->pending_bio_list, mbio); 1423 bio_list_add(&conf->pending_bio_list, mbio);
1424 conf->pending_count++; 1424 conf->pending_count++;
1425 spin_unlock_irqrestore(&conf->device_lock, flags); 1425 spin_unlock_irqrestore(&conf->device_lock, flags);
1426 if (!mddev_check_plugged(mddev))
1427 md_wakeup_thread(mddev->thread);
1426 } 1428 }
1427 1429
1428 /* Don't remove the bias on 'remaining' (one_write_done) until 1430 /* Don't remove the bias on 'remaining' (one_write_done) until
@@ -1448,9 +1450,6 @@ retry_write:
1448 1450
1449 /* In case raid10d snuck in to freeze_array */ 1451 /* In case raid10d snuck in to freeze_array */
1450 wake_up(&conf->wait_barrier); 1452 wake_up(&conf->wait_barrier);
1451
1452 if (do_sync || !mddev->bitmap || !plugged)
1453 md_wakeup_thread(mddev->thread);
1454} 1453}
1455 1454
1456static void status(struct seq_file *seq, struct mddev *mddev) 1455static void status(struct seq_file *seq, struct mddev *mddev)
@@ -2310,7 +2309,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
2310 if (r10_sync_page_io(rdev, 2309 if (r10_sync_page_io(rdev,
2311 r10_bio->devs[sl].addr + 2310 r10_bio->devs[sl].addr +
2312 sect, 2311 sect,
2313 s<<9, conf->tmppage, WRITE) 2312 s, conf->tmppage, WRITE)
2314 == 0) { 2313 == 0) {
2315 /* Well, this device is dead */ 2314 /* Well, this device is dead */
2316 printk(KERN_NOTICE 2315 printk(KERN_NOTICE
@@ -2349,7 +2348,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
2349 switch (r10_sync_page_io(rdev, 2348 switch (r10_sync_page_io(rdev,
2350 r10_bio->devs[sl].addr + 2349 r10_bio->devs[sl].addr +
2351 sect, 2350 sect,
2352 s<<9, conf->tmppage, 2351 s, conf->tmppage,
2353 READ)) { 2352 READ)) {
2354 case 0: 2353 case 0:
2355 /* Well, this device is dead */ 2354 /* Well, this device is dead */
@@ -2512,7 +2511,7 @@ read_more:
2512 slot = r10_bio->read_slot; 2511 slot = r10_bio->read_slot;
2513 printk_ratelimited( 2512 printk_ratelimited(
2514 KERN_ERR 2513 KERN_ERR
2515 "md/raid10:%s: %s: redirecting" 2514 "md/raid10:%s: %s: redirecting "
2516 "sector %llu to another mirror\n", 2515 "sector %llu to another mirror\n",
2517 mdname(mddev), 2516 mdname(mddev),
2518 bdevname(rdev->bdev, b), 2517 bdevname(rdev->bdev, b),
@@ -2661,7 +2660,8 @@ static void raid10d(struct mddev *mddev)
2661 blk_start_plug(&plug); 2660 blk_start_plug(&plug);
2662 for (;;) { 2661 for (;;) {
2663 2662
2664 flush_pending_writes(conf); 2663 if (atomic_read(&mddev->plug_cnt) == 0)
2664 flush_pending_writes(conf);
2665 2665
2666 spin_lock_irqsave(&conf->device_lock, flags); 2666 spin_lock_irqsave(&conf->device_lock, flags);
2667 if (list_empty(head)) { 2667 if (list_empty(head)) {
@@ -2890,6 +2890,12 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
2890 /* want to reconstruct this device */ 2890 /* want to reconstruct this device */
2891 rb2 = r10_bio; 2891 rb2 = r10_bio;
2892 sect = raid10_find_virt(conf, sector_nr, i); 2892 sect = raid10_find_virt(conf, sector_nr, i);
2893 if (sect >= mddev->resync_max_sectors) {
2894 /* last stripe is not complete - don't
2895 * try to recover this sector.
2896 */
2897 continue;
2898 }
2893 /* Unless we are doing a full sync, or a replacement 2899 /* Unless we are doing a full sync, or a replacement
2894 * we only need to recover the block if it is set in 2900 * we only need to recover the block if it is set in
2895 * the bitmap 2901 * the bitmap
@@ -3421,7 +3427,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
3421 spin_lock_init(&conf->resync_lock); 3427 spin_lock_init(&conf->resync_lock);
3422 init_waitqueue_head(&conf->wait_barrier); 3428 init_waitqueue_head(&conf->wait_barrier);
3423 3429
3424 conf->thread = md_register_thread(raid10d, mddev, NULL); 3430 conf->thread = md_register_thread(raid10d, mddev, "raid10");
3425 if (!conf->thread) 3431 if (!conf->thread)
3426 goto out; 3432 goto out;
3427 3433