aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md-cluster.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2014-06-07 03:30:30 -0400
committerGoldwyn Rodrigues <rgoldwyn@suse.com>2015-02-23 10:59:07 -0500
commite59721ccdc65dd4fbd8f311a063ecc8f6232dbcc (patch)
tree9d898010edf0ce5a344aa9bda6ff45865df3f62a /drivers/md/md-cluster.c
parent965400eb615dfb32d62cb3319a895bd94eb9f3b4 (diff)
Resync start/Finish actions
When a RESYNC_START message arrives, the node removes the entry with the current slot number and adds the range to the suspend_list. Simlarly, when a RESYNC_FINISHED message is received, node clears entry with respect to the bitmap number. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Diffstat (limited to 'drivers/md/md-cluster.c')
-rw-r--r--drivers/md/md-cluster.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 6428cc3ce38d..6b0dffebc90f 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -314,6 +314,50 @@ static void ack_bast(void *arg, int mode)
314 md_wakeup_thread(cinfo->recv_thread); 314 md_wakeup_thread(cinfo->recv_thread);
315} 315}
316 316
317static void __remove_suspend_info(struct md_cluster_info *cinfo, int slot)
318{
319 struct suspend_info *s, *tmp;
320
321 list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list)
322 if (slot == s->slot) {
323 pr_info("%s:%d Deleting suspend_info: %d\n",
324 __func__, __LINE__, slot);
325 list_del(&s->list);
326 kfree(s);
327 break;
328 }
329}
330
331static void remove_suspend_info(struct md_cluster_info *cinfo, int slot)
332{
333 spin_lock_irq(&cinfo->suspend_lock);
334 __remove_suspend_info(cinfo, slot);
335 spin_unlock_irq(&cinfo->suspend_lock);
336}
337
338
339static void process_suspend_info(struct md_cluster_info *cinfo,
340 int slot, sector_t lo, sector_t hi)
341{
342 struct suspend_info *s;
343
344 if (!hi) {
345 remove_suspend_info(cinfo, slot);
346 return;
347 }
348 s = kzalloc(sizeof(struct suspend_info), GFP_KERNEL);
349 if (!s)
350 return;
351 s->slot = slot;
352 s->lo = lo;
353 s->hi = hi;
354 spin_lock_irq(&cinfo->suspend_lock);
355 /* Remove existing entry (if exists) before adding */
356 __remove_suspend_info(cinfo, slot);
357 list_add(&s->list, &cinfo->suspend_list);
358 spin_unlock_irq(&cinfo->suspend_lock);
359}
360
317static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg) 361static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
318{ 362{
319 switch (msg->type) { 363 switch (msg->type) {
@@ -325,6 +369,8 @@ static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
325 case RESYNCING: 369 case RESYNCING:
326 pr_info("%s: %d Received message: RESYNCING from %d\n", 370 pr_info("%s: %d Received message: RESYNCING from %d\n",
327 __func__, __LINE__, msg->slot); 371 __func__, __LINE__, msg->slot);
372 process_suspend_info(mddev->cluster_info, msg->slot,
373 msg->low, msg->high);
328 break; 374 break;
329 }; 375 };
330} 376}