X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=block%2Fblk-throttle.c;h=df1a741f1a1c7d760f5c97d4d71fd681d1aa1e96;hb=ca7147e06b5a2a1df5c753b08f56c62162ef71a5;hp=d19f416d61012ac032c49608f0afe463c948e8bc;hpb=baa35cc322c1f6c43506ee9a32c232b05a7eaa8c;p=mirror_ubuntu-bionic-kernel.git diff --git a/block/blk-throttle.c b/block/blk-throttle.c index d19f416d6101..df1a741f1a1c 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -892,13 +892,10 @@ static bool tg_with_in_iops_limit(struct throtl_grp *tg, struct bio *bio, unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; u64 tmp; - jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw]; - - /* Slice has just started. Consider one slice interval */ - if (!jiffy_elapsed) - jiffy_elapsed_rnd = tg->td->throtl_slice; + jiffy_elapsed = jiffies - tg->slice_start[rw]; - jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice); + /* Round up to the next throttle slice, wait time must be nonzero */ + jiffy_elapsed_rnd = roundup(jiffy_elapsed + 1, tg->td->throtl_slice); /* * jiffy_elapsed_rnd should not be a big value as minimum iops can be