aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md-cluster.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2014-06-07 03:39:37 -0400
committerGoldwyn Rodrigues <rgoldwyn@suse.com>2015-02-23 10:59:07 -0500
commit589a1c491621ab81a1955d17d634636522c1b4c1 (patch)
treeb476b0701562e54da42f4664f4ee81e8bb39f563 /drivers/md/md-cluster.c
parente59721ccdc65dd4fbd8f311a063ecc8f6232dbcc (diff)
Suspend writes in RAID1 if within range
If there is a resync going on, all nodes must suspend writes to the range. This is recorded in the suspend_info/suspend_list. If there is an I/O within the ranges of any of the suspend_info, should_suspend will return 1. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Diffstat (limited to 'drivers/md/md-cluster.c')
-rw-r--r--drivers/md/md-cluster.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 6b0dffebc90f..d85a6ca4443e 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -723,6 +723,25 @@ static void resync_finish(struct mddev *mddev)
723 resync_send(mddev, RESYNCING, 0, 0); 723 resync_send(mddev, RESYNCING, 0, 0);
724} 724}
725 725
726static int area_resyncing(struct mddev *mddev, sector_t lo, sector_t hi)
727{
728 struct md_cluster_info *cinfo = mddev->cluster_info;
729 int ret = 0;
730 struct suspend_info *s;
731
732 spin_lock_irq(&cinfo->suspend_lock);
733 if (list_empty(&cinfo->suspend_list))
734 goto out;
735 list_for_each_entry(s, &cinfo->suspend_list, list)
736 if (hi > s->lo && lo < s->hi) {
737 ret = 1;
738 break;
739 }
740out:
741 spin_unlock_irq(&cinfo->suspend_lock);
742 return ret;
743}
744
726static struct md_cluster_operations cluster_ops = { 745static struct md_cluster_operations cluster_ops = {
727 .join = join, 746 .join = join,
728 .leave = leave, 747 .leave = leave,
@@ -733,6 +752,7 @@ static struct md_cluster_operations cluster_ops = {
733 .metadata_update_start = metadata_update_start, 752 .metadata_update_start = metadata_update_start,
734 .metadata_update_finish = metadata_update_finish, 753 .metadata_update_finish = metadata_update_finish,
735 .metadata_update_cancel = metadata_update_cancel, 754 .metadata_update_cancel = metadata_update_cancel,
755 .area_resyncing = area_resyncing,
736}; 756};
737 757
738static int __init cluster_init(void) 758static int __init cluster_init(void)