Skip to content

Commit

Permalink
blk-throttle: Eliminate redundant checks for data direction
Browse files Browse the repository at this point in the history
After calling throtl_peek_queued(), the data direction can be determined so
there is no need to call bio_data_dir() to check the direction again.

Signed-off-by: Tang Yizhou <yizhou.tang@shopee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20240123081248.3752878-1-yizhou.tang@shopee.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Tang Yizhou authored and Jens Axboe committed Feb 5, 2024
1 parent 06b23f9 commit 3bca764
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ static int throtl_dispatch_tg(struct throtl_grp *tg)
while ((bio = throtl_peek_queued(&sq->queued[READ])) &&
tg_may_dispatch(tg, bio, NULL)) {

tg_dispatch_one_bio(tg, bio_data_dir(bio));
tg_dispatch_one_bio(tg, READ);
nr_reads++;

if (nr_reads >= max_nr_reads)
Expand All @@ -1108,7 +1108,7 @@ static int throtl_dispatch_tg(struct throtl_grp *tg)
while ((bio = throtl_peek_queued(&sq->queued[WRITE])) &&
tg_may_dispatch(tg, bio, NULL)) {

tg_dispatch_one_bio(tg, bio_data_dir(bio));
tg_dispatch_one_bio(tg, WRITE);
nr_writes++;

if (nr_writes >= max_nr_writes)
Expand Down

0 comments on commit 3bca764

Please sign in to comment.