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.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 55de4f6f7eaf..40b35be34f8d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -494,7 +494,6 @@ static void raid1_end_write_request(struct bio *bio, int error)
494 bio_put(to_put); 494 bio_put(to_put);
495} 495}
496 496
497
498/* 497/*
499 * This routine returns the disk from which the requested read should 498 * This routine returns the disk from which the requested read should
500 * be done. There is a per-array 'next expected sequential IO' sector 499 * be done. There is a per-array 'next expected sequential IO' sector
@@ -901,18 +900,18 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio)
901 * However if there are already pending 900 * However if there are already pending
902 * requests (preventing the barrier from 901 * requests (preventing the barrier from
903 * rising completely), and the 902 * rising completely), and the
904 * pre-process bio queue isn't empty, 903 * per-process bio queue isn't empty,
905 * then don't wait, as we need to empty 904 * then don't wait, as we need to empty
906 * that queue to get the nr_pending 905 * that queue to allow conf->start_next_window
907 * count down. 906 * to increase.
908 */ 907 */
909 wait_event_lock_irq(conf->wait_barrier, 908 wait_event_lock_irq(conf->wait_barrier,
910 !conf->array_frozen && 909 !conf->array_frozen &&
911 (!conf->barrier || 910 (!conf->barrier ||
912 ((conf->start_next_window < 911 ((conf->start_next_window <
913 conf->next_resync + RESYNC_SECTORS) && 912 conf->next_resync + RESYNC_SECTORS) &&
914 current->bio_list && 913 current->bio_list &&
915 !bio_list_empty(current->bio_list))), 914 !bio_list_empty(current->bio_list))),
916 conf->resync_lock); 915 conf->resync_lock);
917 conf->nr_waiting--; 916 conf->nr_waiting--;
918 } 917 }
@@ -1001,8 +1000,7 @@ static void unfreeze_array(struct r1conf *conf)
1001 spin_unlock_irq(&conf->resync_lock); 1000 spin_unlock_irq(&conf->resync_lock);
1002} 1001}
1003 1002
1004 1003/* duplicate the data pages for behind I/O
1005/* duplicate the data pages for behind I/O
1006 */ 1004 */
1007static void alloc_behind_pages(struct bio *bio, struct r1bio *r1_bio) 1005static void alloc_behind_pages(struct bio *bio, struct r1bio *r1_bio)
1008{ 1006{
@@ -1471,7 +1469,6 @@ static void status(struct seq_file *seq, struct mddev *mddev)
1471 seq_printf(seq, "]"); 1469 seq_printf(seq, "]");
1472} 1470}
1473 1471
1474
1475static void error(struct mddev *mddev, struct md_rdev *rdev) 1472static void error(struct mddev *mddev, struct md_rdev *rdev)
1476{ 1473{
1477 char b[BDEVNAME_SIZE]; 1474 char b[BDEVNAME_SIZE];
@@ -1565,7 +1562,7 @@ static int raid1_spare_active(struct mddev *mddev)
1565 unsigned long flags; 1562 unsigned long flags;
1566 1563
1567 /* 1564 /*
1568 * Find all failed disks within the RAID1 configuration 1565 * Find all failed disks within the RAID1 configuration
1569 * and mark them readable. 1566 * and mark them readable.
1570 * Called under mddev lock, so rcu protection not needed. 1567 * Called under mddev lock, so rcu protection not needed.
1571 */ 1568 */
@@ -1606,7 +1603,6 @@ static int raid1_spare_active(struct mddev *mddev)
1606 return count; 1603 return count;
1607} 1604}
1608 1605
1609
1610static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev) 1606static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
1611{ 1607{
1612 struct r1conf *conf = mddev->private; 1608 struct r1conf *conf = mddev->private;
@@ -1735,7 +1731,6 @@ abort:
1735 return err; 1731 return err;
1736} 1732}
1737 1733
1738
1739static void end_sync_read(struct bio *bio, int error) 1734static void end_sync_read(struct bio *bio, int error)
1740{ 1735{
1741 struct r1bio *r1_bio = bio->bi_private; 1736 struct r1bio *r1_bio = bio->bi_private;
@@ -1947,7 +1942,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
1947 return 1; 1942 return 1;
1948} 1943}
1949 1944
1950static int process_checks(struct r1bio *r1_bio) 1945static void process_checks(struct r1bio *r1_bio)
1951{ 1946{
1952 /* We have read all readable devices. If we haven't 1947 /* We have read all readable devices. If we haven't
1953 * got the block, then there is no hope left. 1948 * got the block, then there is no hope left.
@@ -2039,7 +2034,6 @@ static int process_checks(struct r1bio *r1_bio)
2039 2034
2040 bio_copy_data(sbio, pbio); 2035 bio_copy_data(sbio, pbio);
2041 } 2036 }
2042 return 0;
2043} 2037}
2044 2038
2045static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio) 2039static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
@@ -2057,8 +2051,8 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
2057 return; 2051 return;
2058 2052
2059 if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) 2053 if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
2060 if (process_checks(r1_bio) < 0) 2054 process_checks(r1_bio);
2061 return; 2055
2062 /* 2056 /*
2063 * schedule writes 2057 * schedule writes
2064 */ 2058 */
@@ -2458,7 +2452,6 @@ static void raid1d(struct md_thread *thread)
2458 blk_finish_plug(&plug); 2452 blk_finish_plug(&plug);
2459} 2453}
2460 2454
2461
2462static int init_resync(struct r1conf *conf) 2455static int init_resync(struct r1conf *conf)
2463{ 2456{
2464 int buffs; 2457 int buffs;
@@ -2722,7 +2715,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
2722 /* remove last page from this bio */ 2715 /* remove last page from this bio */
2723 bio->bi_vcnt--; 2716 bio->bi_vcnt--;
2724 bio->bi_iter.bi_size -= len; 2717 bio->bi_iter.bi_size -= len;
2725 bio->bi_flags &= ~(1<< BIO_SEG_VALID); 2718 __clear_bit(BIO_SEG_VALID, &bio->bi_flags);
2726 } 2719 }
2727 goto bio_full; 2720 goto bio_full;
2728 } 2721 }
@@ -2947,9 +2940,9 @@ static int run(struct mddev *mddev)
2947 printk(KERN_NOTICE "md/raid1:%s: not clean" 2940 printk(KERN_NOTICE "md/raid1:%s: not clean"
2948 " -- starting background reconstruction\n", 2941 " -- starting background reconstruction\n",
2949 mdname(mddev)); 2942 mdname(mddev));
2950 printk(KERN_INFO 2943 printk(KERN_INFO
2951 "md/raid1:%s: active with %d out of %d mirrors\n", 2944 "md/raid1:%s: active with %d out of %d mirrors\n",
2952 mdname(mddev), mddev->raid_disks - mddev->degraded, 2945 mdname(mddev), mddev->raid_disks - mddev->degraded,
2953 mddev->raid_disks); 2946 mddev->raid_disks);
2954 2947
2955 /* 2948 /*