diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-03-02 09:03:44 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-03-11 10:09:03 -0500 |
commit | 309d1608cce32903d67d47e7545e232c400b6aa0 (patch) | |
tree | 98a201235ac87dce320cef6401e782d34bfb29b0 | |
parent | c42b6cf4b38c9726d4b46c48d04197c9ca74d773 (diff) |
drbd: Reduce the time an empty resync takes usually
This mitigates changes introduced with commit:
http://git.drbd.org/?p=drbd-8.3.git;a=commit;h=4b6803a3276652da3737
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 1 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 12 |
3 files changed, 12 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 844206c31851..2d5cebbbf253 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -800,6 +800,7 @@ enum { | |||
800 | RESIZE_PENDING, /* Size change detected locally, waiting for the response from | 800 | RESIZE_PENDING, /* Size change detected locally, waiting for the response from |
801 | * the peer, if it changed there as well. */ | 801 | * the peer, if it changed there as well. */ |
802 | CONN_DRY_RUN, /* Expect disconnect after resync handshake. */ | 802 | CONN_DRY_RUN, /* Expect disconnect after resync handshake. */ |
803 | GOT_PING_ACK, /* set when we receive a ping_ack packet, misc wait gets woken */ | ||
803 | }; | 804 | }; |
804 | 805 | ||
805 | struct drbd_bitmap; /* opaque for drbd_conf */ | 806 | struct drbd_bitmap; /* opaque for drbd_conf */ |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index d803e6c257e2..ed9f1de24a71 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -4074,6 +4074,8 @@ static int got_PingAck(struct drbd_conf *mdev, struct p_header *h) | |||
4074 | { | 4074 | { |
4075 | /* restore idle timeout */ | 4075 | /* restore idle timeout */ |
4076 | mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ; | 4076 | mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ; |
4077 | if (!test_and_set_bit(GOT_PING_ACK, &mdev->flags)) | ||
4078 | wake_up(&mdev->misc_wait); | ||
4077 | 4079 | ||
4078 | return TRUE; | 4080 | return TRUE; |
4079 | } | 4081 | } |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index d97a811ad0d2..4672f2f37b51 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -1289,6 +1289,14 @@ int drbd_alter_sa(struct drbd_conf *mdev, int na) | |||
1289 | return retcode; | 1289 | return retcode; |
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | static void ping_peer(struct drbd_conf *mdev) | ||
1293 | { | ||
1294 | clear_bit(GOT_PING_ACK, &mdev->flags); | ||
1295 | request_ping(mdev); | ||
1296 | wait_event(mdev->misc_wait, | ||
1297 | test_bit(GOT_PING_ACK, &mdev->flags) || mdev->state.conn < C_CONNECTED); | ||
1298 | } | ||
1299 | |||
1292 | /** | 1300 | /** |
1293 | * drbd_start_resync() - Start the resync process | 1301 | * drbd_start_resync() - Start the resync process |
1294 | * @mdev: DRBD device. | 1302 | * @mdev: DRBD device. |
@@ -1383,9 +1391,7 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side) | |||
1383 | 1391 | ||
1384 | if (mdev->rs_total == 0) { | 1392 | if (mdev->rs_total == 0) { |
1385 | /* Peer still reachable? Beware of failing before-resync-target handlers! */ | 1393 | /* Peer still reachable? Beware of failing before-resync-target handlers! */ |
1386 | request_ping(mdev); | 1394 | ping_peer(mdev); |
1387 | __set_current_state(TASK_INTERRUPTIBLE); | ||
1388 | schedule_timeout(mdev->net_conf->ping_timeo*HZ/9); /* 9 instead 10 */ | ||
1389 | drbd_resync_finished(mdev); | 1395 | drbd_resync_finished(mdev); |
1390 | return; | 1396 | return; |
1391 | } | 1397 | } |