aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_worker.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-01-14 10:03:11 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:45:36 -0500
commit370a43e7982dd497822097e0ae6022947ac2e7d4 (patch)
treea501836af9959177a1ef9b6746ab21c3b3af6d94 /drivers/block/drbd/drbd_worker.c
parent71c78cfba232de8f61a4b1bbb6e876424d133407 (diff)
drbd: Work on the Ahead -> SyncSource transition
The test if rs_pending_cnt == 0 was too weak. Using Test for unacked_cnt == 0 instead. Moved that into the worker. Since unacked_cnt gets already increased when an P_RS_DATA_REQ comes in. Also using a timer to make Ahead -> SyncSource -> Ahead cycles slower... Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_worker.c')
-rw-r--r--drivers/block/drbd/drbd_worker.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 147f76b26810..3a95b701b5d0 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -712,10 +712,24 @@ static int w_make_ov_request(struct drbd_conf *mdev, struct drbd_work *w, int ca
712} 712}
713 713
714 714
715void start_resync_timer_fn(unsigned long data)
716{
717 struct drbd_conf *mdev = (struct drbd_conf *) data;
718
719 drbd_queue_work(&mdev->data.work, &mdev->start_resync_work);
720}
721
715int w_start_resync(struct drbd_conf *mdev, struct drbd_work *w, int cancel) 722int w_start_resync(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
716{ 723{
717 drbd_start_resync(mdev, C_SYNC_SOURCE); 724 if (atomic_read(&mdev->unacked_cnt) || atomic_read(&mdev->rs_pending_cnt)) {
725 dev_warn(DEV, "w_start_resync later...\n");
726 mdev->start_resync_timer.expires = jiffies + HZ/10;
727 add_timer(&mdev->start_resync_timer);
728 return 1;
729 }
718 730
731 drbd_start_resync(mdev, C_SYNC_SOURCE);
732 clear_bit(AHEAD_TO_SYNC_SOURCE, &mdev->current_epoch->flags);
719 return 1; 733 return 1;
720} 734}
721 735