diff options
Diffstat (limited to 'drivers/md/md-cluster.c')
| -rw-r--r-- | drivers/md/md-cluster.c | 46 | 
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 | ||
| 317 | static 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 | |||
| 331 | static 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 | |||
| 339 | static 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 | |||
| 317 | static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg) | 361 | static 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 | } | 
