Commit c013710e authored by Yu Kuai's avatar Yu Kuai Committed by Jens Axboe

blk-throttle: cleanup tg_update_disptime()

tg_update_disptime() only need to adjust postion for 'tg' in
'parent_sq', there is no need to call throtl_enqueue/dequeue_tg(),
since they will set/clear flag THROTL_TG_PENDING and increase/decrease
nr_pending, which is useless. By the way, clear the flag/decrease
nr_pending while there are still throttled bios is not good for debugging.

There are no functional changes.
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20220827101637.1775111-4-yukuai1@huaweicloud.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8c25ed0c
...@@ -520,7 +520,6 @@ static void throtl_rb_erase(struct rb_node *n, ...@@ -520,7 +520,6 @@ static void throtl_rb_erase(struct rb_node *n,
{ {
rb_erase_cached(n, &parent_sq->pending_tree); rb_erase_cached(n, &parent_sq->pending_tree);
RB_CLEAR_NODE(n); RB_CLEAR_NODE(n);
--parent_sq->nr_pending;
} }
static void update_min_dispatch_time(struct throtl_service_queue *parent_sq) static void update_min_dispatch_time(struct throtl_service_queue *parent_sq)
...@@ -572,7 +571,11 @@ static void throtl_enqueue_tg(struct throtl_grp *tg) ...@@ -572,7 +571,11 @@ static void throtl_enqueue_tg(struct throtl_grp *tg)
static void throtl_dequeue_tg(struct throtl_grp *tg) static void throtl_dequeue_tg(struct throtl_grp *tg)
{ {
if (tg->flags & THROTL_TG_PENDING) { if (tg->flags & THROTL_TG_PENDING) {
throtl_rb_erase(&tg->rb_node, tg->service_queue.parent_sq); struct throtl_service_queue *parent_sq =
tg->service_queue.parent_sq;
throtl_rb_erase(&tg->rb_node, parent_sq);
--parent_sq->nr_pending;
tg->flags &= ~THROTL_TG_PENDING; tg->flags &= ~THROTL_TG_PENDING;
} }
} }
...@@ -1034,9 +1037,9 @@ static void tg_update_disptime(struct throtl_grp *tg) ...@@ -1034,9 +1037,9 @@ static void tg_update_disptime(struct throtl_grp *tg)
disptime = jiffies + min_wait; disptime = jiffies + min_wait;
/* Update dispatch time */ /* Update dispatch time */
throtl_dequeue_tg(tg); throtl_rb_erase(&tg->rb_node, tg->service_queue.parent_sq);
tg->disptime = disptime; tg->disptime = disptime;
throtl_enqueue_tg(tg); tg_service_queue_add(tg);
/* see throtl_add_bio_tg() */ /* see throtl_add_bio_tg() */
tg->flags &= ~THROTL_TG_WAS_EMPTY; tg->flags &= ~THROTL_TG_WAS_EMPTY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment