Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196857
b: refs/heads/master
c: cdd67a7
h: refs/heads/master
i:
  196855: efc168e
v: v3
  • Loading branch information
Philipp Reisner committed May 17, 2010
1 parent f6a897f commit 297ef85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bd26bfc5b4253425d17aa49648ae1f3e976041c4
refs/heads/master: cdd67a74603d0453ddffc24c572aed2ddd1795b8
15 changes: 14 additions & 1 deletion trunk/drivers/block/drbd/drbd_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,18 @@ void resync_timer_fn(unsigned long data)
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,
struct drbd_work *w, int cancel)
{
Expand Down Expand Up @@ -446,7 +458,8 @@ int w_make_resync_request(struct drbd_conf *mdev,
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);

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

0 comments on commit 297ef85

Please sign in to comment.