aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-12-13 20:49:51 -0500
committerNeilBrown <neilb@suse.de>2009-12-13 20:51:40 -0500
commit6eef4b21ffc9207b78fdd718154f5b004644b97d (patch)
tree554d8dafa2cd8ff7a9e719b12bd2f07c9745e7be /drivers/md/raid1.c
parent729a18663a30a9c8076e3adc2b3e4c866974f935 (diff)
md: add honouring of suspend_{lo,hi} to raid1.
This will allow us to stop writeout to portions of the array while they are resynced by someone else - e.g. another node in a cluster. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index e07ce2e033a9..35b2d8646ae9 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -801,6 +801,25 @@ static int make_request(struct request_queue *q, struct bio * bio)
801 801
802 md_write_start(mddev, bio); /* wait on superblock update early */ 802 md_write_start(mddev, bio); /* wait on superblock update early */
803 803
804 if (bio_data_dir(bio) == WRITE &&
805 bio->bi_sector + bio->bi_size/512 > mddev->suspend_lo &&
806 bio->bi_sector < mddev->suspend_hi) {
807 /* As the suspend_* range is controlled by
808 * userspace, we want an interruptible
809 * wait.
810 */
811 DEFINE_WAIT(w);
812 for (;;) {
813 flush_signals(current);
814 prepare_to_wait(&conf->wait_barrier,
815 &w, TASK_INTERRUPTIBLE);
816 if (bio->bi_sector + bio->bi_size/512 <= mddev->suspend_lo ||
817 bio->bi_sector >= mddev->suspend_hi)
818 break;
819 schedule();
820 }
821 finish_wait(&conf->wait_barrier, &w);
822 }
804 if (unlikely(!mddev->barriers_work && 823 if (unlikely(!mddev->barriers_work &&
805 bio_rw_flagged(bio, BIO_RW_BARRIER))) { 824 bio_rw_flagged(bio, BIO_RW_BARRIER))) {
806 if (rw == WRITE) 825 if (rw == WRITE)
@@ -2271,6 +2290,9 @@ static void raid1_quiesce(mddev_t *mddev, int state)
2271 conf_t *conf = mddev->private; 2290 conf_t *conf = mddev->private;
2272 2291
2273 switch(state) { 2292 switch(state) {
2293 case 2: /* wake for suspend */
2294 wake_up(&conf->wait_barrier);
2295 break;
2274 case 1: 2296 case 1:
2275 raise_barrier(conf); 2297 raise_barrier(conf);
2276 break; 2298 break;