diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-05-04 10:57:18 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-05-17 19:25:47 -0400 |
commit | cdd67a74603d0453ddffc24c572aed2ddd1795b8 (patch) | |
tree | d2a478bf8b225540044895ccf5b3b1575cc8bbd4 | |
parent | bd26bfc5b4253425d17aa49648ae1f3e976041c4 (diff) |
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: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 44bf6d11197e..0bbecf45b485 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -414,6 +414,18 @@ void resync_timer_fn(unsigned long data) | |||
414 | drbd_queue_work(&mdev->data.work, &mdev->resync_work); | 414 | drbd_queue_work(&mdev->data.work, &mdev->resync_work); |
415 | } | 415 | } |
416 | 416 | ||
417 | static int calc_resync_rate(struct drbd_conf *mdev) | ||
418 | { | ||
419 | int d = mdev->data_delay / 1000; /* us -> ms */ | ||
420 | int td = mdev->sync_conf.throttle_th * 100; /* 0.1s -> ms */ | ||
421 | int hd = mdev->sync_conf.hold_off_th * 100; /* 0.1s -> ms */ | ||
422 | int cr = mdev->sync_conf.rate; | ||
423 | |||
424 | return d <= td ? cr : | ||
425 | d >= hd ? 0 : | ||
426 | cr + (cr * (td - d) / (hd - td)); | ||
427 | } | ||
428 | |||
417 | int w_make_resync_request(struct drbd_conf *mdev, | 429 | int w_make_resync_request(struct drbd_conf *mdev, |
418 | struct drbd_work *w, int cancel) | 430 | struct drbd_work *w, int cancel) |
419 | { | 431 | { |
@@ -446,7 +458,8 @@ int w_make_resync_request(struct drbd_conf *mdev, | |||
446 | return 1; | 458 | return 1; |
447 | } | 459 | } |
448 | 460 | ||
449 | number = SLEEP_TIME * mdev->sync_conf.rate / ((BM_BLOCK_SIZE/1024)*HZ); | 461 | mdev->c_sync_rate = calc_resync_rate(mdev); |
462 | number = SLEEP_TIME * mdev->c_sync_rate / ((BM_BLOCK_SIZE / 1024) * HZ); | ||
450 | pe = atomic_read(&mdev->rs_pending_cnt); | 463 | pe = atomic_read(&mdev->rs_pending_cnt); |
451 | 464 | ||
452 | mutex_lock(&mdev->data.mutex); | 465 | mutex_lock(&mdev->data.mutex); |