Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 309d1608 authored by Philipp Reisner's avatar Philipp Reisner
Browse files

drbd: Reduce the time an empty resync takes usually

parent c42b6cf4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -800,6 +800,7 @@ enum {
	RESIZE_PENDING,		/* Size change detected locally, waiting for the response from
				 * the peer, if it changed there as well. */
	CONN_DRY_RUN,		/* Expect disconnect after resync handshake. */
	GOT_PING_ACK,		/* set when we receive a ping_ack packet, misc wait gets woken */
};

struct drbd_bitmap; /* opaque for drbd_conf */
+2 −0
Original line number Diff line number Diff line
@@ -4074,6 +4074,8 @@ static int got_PingAck(struct drbd_conf *mdev, struct p_header *h)
{
	/* restore idle timeout */
	mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ;
	if (!test_and_set_bit(GOT_PING_ACK, &mdev->flags))
		wake_up(&mdev->misc_wait);

	return TRUE;
}
+9 −3
Original line number Diff line number Diff line
@@ -1289,6 +1289,14 @@ int drbd_alter_sa(struct drbd_conf *mdev, int na)
	return retcode;
}

static void ping_peer(struct drbd_conf *mdev)
{
	clear_bit(GOT_PING_ACK, &mdev->flags);
	request_ping(mdev);
	wait_event(mdev->misc_wait,
		   test_bit(GOT_PING_ACK, &mdev->flags) || mdev->state.conn < C_CONNECTED);
}

/**
 * drbd_start_resync() - Start the resync process
 * @mdev:	DRBD device.
@@ -1383,9 +1391,7 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side)

		if (mdev->rs_total == 0) {
			/* Peer still reachable? Beware of failing before-resync-target handlers! */
			request_ping(mdev);
			__set_current_state(TASK_INTERRUPTIBLE);
			schedule_timeout(mdev->net_conf->ping_timeo*HZ/9); /* 9 instead 10 */
			ping_peer(mdev);
			drbd_resync_finished(mdev);
			return;
		}