Skip to content

Commit

Permalink
blk-throttle: Avoid checking bps/iops limitation if bps or iops is un…
Browse files Browse the repository at this point in the history
…limited

Do not need check the bps or iops limitation if bps or iops is unlimited.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Baolin Wang authored and Jens Axboe committed Sep 15, 2020
1 parent 4599ea4 commit 87fbeb8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,12 @@ 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;

if (iops_limit == UINT_MAX) {
if (wait)
*wait = 0;
return true;
}

jiffy_elapsed = jiffies - tg->slice_start[rw];

/* Round up to the next throttle slice, wait time must be nonzero */
Expand Down Expand Up @@ -943,6 +949,12 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio,
unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd;
unsigned int bio_size = throtl_bio_data_size(bio);

if (bps_limit == U64_MAX) {
if (wait)
*wait = 0;
return true;
}

jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw];

/* Slice has just started. Consider one slice interval */
Expand Down

0 comments on commit 87fbeb8

Please sign in to comment.