Skip to content

Commit 5e901a2

Browse files
rhvgoyalJens Axboe
authored andcommitted
blkio-throttle: There is no need to convert jiffies to milli seconds
o Do not convert jiffies to mili seconds as it is not required. Just work with jiffies and HZ. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent 3aad5d3 commit 5e901a2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎block/blk-throttle.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,7 @@ static bool tg_with_in_iops_limit(struct throtl_data *td, struct throtl_grp *tg,
439439

440440
jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, throtl_slice);
441441

442-
io_allowed = (tg->iops[rw] * jiffies_to_msecs(jiffy_elapsed_rnd))
443-
/ MSEC_PER_SEC;
442+
io_allowed = (tg->iops[rw] * jiffy_elapsed_rnd) / HZ;
444443

445444
if (tg->io_disp[rw] + 1 <= io_allowed) {
446445
if (wait)
@@ -476,8 +475,8 @@ static bool tg_with_in_bps_limit(struct throtl_data *td, struct throtl_grp *tg,
476475

477476
jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, throtl_slice);
478477

479-
tmp = tg->bps[rw] * jiffies_to_msecs(jiffy_elapsed_rnd);
480-
do_div(tmp, MSEC_PER_SEC);
478+
tmp = tg->bps[rw] * jiffy_elapsed_rnd;
479+
do_div(tmp, HZ);
481480
bytes_allowed = tmp;
482481

483482
if (tg->bytes_disp[rw] + bio->bi_size <= bytes_allowed) {

0 commit comments

Comments
 (0)