diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-27 14:44:53 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-27 14:44:53 +0100 |
commit | cc11f372e9371ec3a3dad02396dbe0a55eec0b8f (patch) | |
tree | fd22bdac975ee61053e787ad96c912fddc485370 /drivers/md/bcache/util.c | |
parent | Staging: rtl8812ae: disable due to build errors (diff) | |
parent | Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml (diff) | |
download | linux-cc11f372e9371ec3a3dad02396dbe0a55eec0b8f.tar.xz linux-cc11f372e9371ec3a3dad02396dbe0a55eec0b8f.zip |
Merge branch 'master' into staging-next
We need the network changes in staging-next in order to be able to fix
up the rtl8821ae driver to build properly.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/bcache/util.c')
-rw-r--r-- | drivers/md/bcache/util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index 462214eeacbe..bb37618e7664 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -209,7 +209,13 @@ uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done) { uint64_t now = local_clock(); - d->next += div_u64(done, d->rate); + d->next += div_u64(done * NSEC_PER_SEC, d->rate); + + if (time_before64(now + NSEC_PER_SEC, d->next)) + d->next = now + NSEC_PER_SEC; + + if (time_after64(now - NSEC_PER_SEC * 2, d->next)) + d->next = now - NSEC_PER_SEC * 2; return time_after64(d->next, now) ? div_u64(d->next - now, NSEC_PER_SEC / HZ) |