aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid1.c
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2009-04-02 14:55:30 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-04-02 14:55:30 -0400
commit7513c2a761d69d2a93f17146b3563527d3618ba0 (patch)
tree375a14998a60a47b83962d5a497139112ec6e8e4 /drivers/md/dm-raid1.c
parentb2a114652940ccf7e9668ad447ca78bf16a31139 (diff)
dm raid1: add is_remote_recovering hook for clusters
The logging API needs an extra function to make cluster mirroring possible. This new function allows us to check whether a mirror region is being recovered on another machine in the cluster. This helps us prevent simultaneous recovery I/O and process I/O to the same locations on disk. Cluster-aware log modules will implement this function. Single machine log modules will not. So, there is no performance penalty for single machine mirrors. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Acked-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r--drivers/md/dm-raid1.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 62d594889ac3..536ef0bef154 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -588,6 +588,9 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes)
588 int state; 588 int state;
589 struct bio *bio; 589 struct bio *bio;
590 struct bio_list sync, nosync, recover, *this_list = NULL; 590 struct bio_list sync, nosync, recover, *this_list = NULL;
591 struct bio_list requeue;
592 struct dm_dirty_log *log = dm_rh_dirty_log(ms->rh);
593 region_t region;
591 594
592 if (!writes->head) 595 if (!writes->head)
593 return; 596 return;
@@ -598,10 +601,18 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes)
598 bio_list_init(&sync); 601 bio_list_init(&sync);
599 bio_list_init(&nosync); 602 bio_list_init(&nosync);
600 bio_list_init(&recover); 603 bio_list_init(&recover);
604 bio_list_init(&requeue);
601 605
602 while ((bio = bio_list_pop(writes))) { 606 while ((bio = bio_list_pop(writes))) {
603 state = dm_rh_get_state(ms->rh, 607 region = dm_rh_bio_to_region(ms->rh, bio);
604 dm_rh_bio_to_region(ms->rh, bio), 1); 608
609 if (log->type->is_remote_recovering &&
610 log->type->is_remote_recovering(log, region)) {
611 bio_list_add(&requeue, bio);
612 continue;
613 }
614
615 state = dm_rh_get_state(ms->rh, region, 1);
605 switch (state) { 616 switch (state) {
606 case DM_RH_CLEAN: 617 case DM_RH_CLEAN:
607 case DM_RH_DIRTY: 618 case DM_RH_DIRTY:
@@ -621,6 +632,16 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes)
621 } 632 }
622 633
623 /* 634 /*
635 * Add bios that are delayed due to remote recovery
636 * back on to the write queue
637 */
638 if (unlikely(requeue.head)) {
639 spin_lock_irq(&ms->lock);
640 bio_list_merge(&ms->writes, &requeue);
641 spin_unlock_irq(&ms->lock);
642 }
643
644 /*
624 * Increment the pending counts for any regions that will 645 * Increment the pending counts for any regions that will
625 * be written to (writes to recover regions are going to 646 * be written to (writes to recover regions are going to
626 * be delayed). 647 * be delayed).