aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/drbd/drbd_int.h2
-rw-r--r--drivers/block/drbd/drbd_main.c2
-rw-r--r--drivers/block/drbd/drbd_worker.c48
3 files changed, 13 insertions, 39 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index a529285b0cd3..dc11b7070ba9 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1540,7 +1540,7 @@ extern int w_e_end_csum_rs_req(struct drbd_conf *, struct drbd_work *, int);
1540extern int w_e_end_ov_reply(struct drbd_conf *, struct drbd_work *, int); 1540extern int w_e_end_ov_reply(struct drbd_conf *, struct drbd_work *, int);
1541extern int w_e_end_ov_req(struct drbd_conf *, struct drbd_work *, int); 1541extern int w_e_end_ov_req(struct drbd_conf *, struct drbd_work *, int);
1542extern int w_ov_finished(struct drbd_conf *, struct drbd_work *, int); 1542extern int w_ov_finished(struct drbd_conf *, struct drbd_work *, int);
1543extern int w_resync_inactive(struct drbd_conf *, struct drbd_work *, int); 1543extern int w_resync_timer(struct drbd_conf *, struct drbd_work *, int);
1544extern int w_resume_next_sg(struct drbd_conf *, struct drbd_work *, int); 1544extern int w_resume_next_sg(struct drbd_conf *, struct drbd_work *, int);
1545extern int w_send_write_hint(struct drbd_conf *, struct drbd_work *, int); 1545extern int w_send_write_hint(struct drbd_conf *, struct drbd_work *, int);
1546extern int w_send_dblock(struct drbd_conf *, struct drbd_work *, int); 1546extern int w_send_dblock(struct drbd_conf *, struct drbd_work *, int);
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 90050ab7adf3..4074d6699307 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2978,7 +2978,7 @@ void drbd_init_set_defaults(struct drbd_conf *mdev)
2978 INIT_LIST_HEAD(&mdev->start_resync_work.list); 2978 INIT_LIST_HEAD(&mdev->start_resync_work.list);
2979 INIT_LIST_HEAD(&mdev->bm_io_work.w.list); 2979 INIT_LIST_HEAD(&mdev->bm_io_work.w.list);
2980 2980
2981 mdev->resync_work.cb = w_resync_inactive; 2981 mdev->resync_work.cb = w_resync_timer;
2982 mdev->unplug_work.cb = w_send_write_hint; 2982 mdev->unplug_work.cb = w_send_write_hint;
2983 mdev->go_diskless.cb = w_go_diskless; 2983 mdev->go_diskless.cb = w_go_diskless;
2984 mdev->md_sync_work.cb = w_md_sync; 2984 mdev->md_sync_work.cb = w_md_sync;
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 1d7510ebaa43..147f76b26810 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -253,13 +253,6 @@ int w_read_retry_remote(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
253 return w_send_read_req(mdev, w, 0); 253 return w_send_read_req(mdev, w, 0);
254} 254}
255 255
256int w_resync_inactive(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
257{
258 ERR_IF(cancel) return 1;
259 dev_err(DEV, "resync inactive, but callback triggered??\n");
260 return 1; /* Simply ignore this! */
261}
262
263void drbd_csum_ee(struct drbd_conf *mdev, struct crypto_hash *tfm, struct drbd_epoch_entry *e, void *digest) 256void drbd_csum_ee(struct drbd_conf *mdev, struct crypto_hash *tfm, struct drbd_epoch_entry *e, void *digest)
264{ 257{
265 struct hash_desc desc; 258 struct hash_desc desc;
@@ -389,26 +382,25 @@ defer:
389 return -EAGAIN; 382 return -EAGAIN;
390} 383}
391 384
392void resync_timer_fn(unsigned long data) 385int w_resync_timer(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
393{ 386{
394 struct drbd_conf *mdev = (struct drbd_conf *) data;
395 int queue;
396
397 queue = 1;
398 switch (mdev->state.conn) { 387 switch (mdev->state.conn) {
399 case C_VERIFY_S: 388 case C_VERIFY_S:
400 mdev->resync_work.cb = w_make_ov_request; 389 w_make_ov_request(mdev, w, cancel);
401 break; 390 break;
402 case C_SYNC_TARGET: 391 case C_SYNC_TARGET:
403 mdev->resync_work.cb = w_make_resync_request; 392 w_make_resync_request(mdev, w, cancel);
404 break; 393 break;
405 default:
406 queue = 0;
407 mdev->resync_work.cb = w_resync_inactive;
408 } 394 }
409 395
410 /* harmless race: list_empty outside data.work.q_lock */ 396 return 1;
411 if (list_empty(&mdev->resync_work.list) && queue) 397}
398
399void resync_timer_fn(unsigned long data)
400{
401 struct drbd_conf *mdev = (struct drbd_conf *) data;
402
403 if (list_empty(&mdev->resync_work.list))
412 drbd_queue_work(&mdev->data.work, &mdev->resync_work); 404 drbd_queue_work(&mdev->data.work, &mdev->resync_work);
413} 405}
414 406
@@ -525,15 +517,6 @@ static int w_make_resync_request(struct drbd_conf *mdev,
525 if (unlikely(cancel)) 517 if (unlikely(cancel))
526 return 1; 518 return 1;
527 519
528 if (unlikely(mdev->state.conn < C_CONNECTED)) {
529 dev_err(DEV, "Confused in w_make_resync_request()! cstate < Connected");
530 return 0;
531 }
532
533 if (mdev->state.conn != C_SYNC_TARGET)
534 dev_err(DEV, "%s in w_make_resync_request\n",
535 drbd_conn_str(mdev->state.conn));
536
537 if (mdev->rs_total == 0) { 520 if (mdev->rs_total == 0) {
538 /* empty resync? */ 521 /* empty resync? */
539 drbd_resync_finished(mdev); 522 drbd_resync_finished(mdev);
@@ -546,7 +529,6 @@ static int w_make_resync_request(struct drbd_conf *mdev,
546 to continue resync with a broken disk makes no sense at 529 to continue resync with a broken disk makes no sense at
547 all */ 530 all */
548 dev_err(DEV, "Disk broke down during resync!\n"); 531 dev_err(DEV, "Disk broke down during resync!\n");
549 mdev->resync_work.cb = w_resync_inactive;
550 return 1; 532 return 1;
551 } 533 }
552 534
@@ -580,7 +562,6 @@ next_sector:
580 562
581 if (bit == DRBD_END_OF_BITMAP) { 563 if (bit == DRBD_END_OF_BITMAP) {
582 mdev->bm_resync_fo = drbd_bm_bits(mdev); 564 mdev->bm_resync_fo = drbd_bm_bits(mdev);
583 mdev->resync_work.cb = w_resync_inactive;
584 put_ldev(mdev); 565 put_ldev(mdev);
585 return 1; 566 return 1;
586 } 567 }
@@ -676,7 +657,6 @@ next_sector:
676 * resync data block, and the last bit is cleared. 657 * resync data block, and the last bit is cleared.
677 * until then resync "work" is "inactive" ... 658 * until then resync "work" is "inactive" ...
678 */ 659 */
679 mdev->resync_work.cb = w_resync_inactive;
680 put_ldev(mdev); 660 put_ldev(mdev);
681 return 1; 661 return 1;
682 } 662 }
@@ -697,17 +677,11 @@ static int w_make_ov_request(struct drbd_conf *mdev, struct drbd_work *w, int ca
697 if (unlikely(cancel)) 677 if (unlikely(cancel))
698 return 1; 678 return 1;
699 679
700 if (unlikely(mdev->state.conn < C_CONNECTED)) {
701 dev_err(DEV, "Confused in w_make_ov_request()! cstate < Connected");
702 return 0;
703 }
704
705 number = drbd_rs_number_requests(mdev); 680 number = drbd_rs_number_requests(mdev);
706 681
707 sector = mdev->ov_position; 682 sector = mdev->ov_position;
708 for (i = 0; i < number; i++) { 683 for (i = 0; i < number; i++) {
709 if (sector >= capacity) { 684 if (sector >= capacity) {
710 mdev->resync_work.cb = w_resync_inactive;
711 return 1; 685 return 1;
712 } 686 }
713 687