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

Commit cdd67a74 authored by Philipp Reisner's avatar Philipp Reisner
Browse files

drbd: Control the actual resync rate based on the queuing delay of data packets



In a setup with a high bandwidth and high latency network, eventually
involving deep queues in routers, it is beneficial to only fill those
queues up to an limited extend with resync data.

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent bd26bfc5
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -414,6 +414,18 @@ void resync_timer_fn(unsigned long data)
		drbd_queue_work(&mdev->data.work, &mdev->resync_work);
		drbd_queue_work(&mdev->data.work, &mdev->resync_work);
}
}


static int calc_resync_rate(struct drbd_conf *mdev)
{
	int d = mdev->data_delay / 1000; /* us -> ms */
	int td = mdev->sync_conf.throttle_th * 100;  /* 0.1s -> ms */
	int hd = mdev->sync_conf.hold_off_th * 100;  /* 0.1s -> ms */
	int cr = mdev->sync_conf.rate;

	return d <= td ? cr :
		d >= hd ? 0 :
		cr + (cr * (td - d) / (hd - td));
}

int w_make_resync_request(struct drbd_conf *mdev,
int w_make_resync_request(struct drbd_conf *mdev,
		struct drbd_work *w, int cancel)
		struct drbd_work *w, int cancel)
{
{
@@ -446,7 +458,8 @@ int w_make_resync_request(struct drbd_conf *mdev,
		return 1;
		return 1;
	}
	}


	number = SLEEP_TIME * mdev->sync_conf.rate / ((BM_BLOCK_SIZE/1024)*HZ);
	mdev->c_sync_rate = calc_resync_rate(mdev);
	number = SLEEP_TIME * mdev->c_sync_rate  / ((BM_BLOCK_SIZE / 1024) * HZ);
	pe = atomic_read(&mdev->rs_pending_cnt);
	pe = atomic_read(&mdev->rs_pending_cnt);


	mutex_lock(&mdev->data.mutex);
	mutex_lock(&mdev->data.mutex);