Skip to content

Commit

Permalink
blk-throttle: Open code __throtl_de/enqueue_tg()
Browse files Browse the repository at this point in the history
The __throtl_de/enqueue_tg() functions are only be called by
throtl_de/enqueue_tg(), thus we can just open code them to
make code more readable.

Signed-off-by: Baolin Wang <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Baolin Wang authored and axboe committed Oct 8, 2020
1 parent 2397611 commit 2937967
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,29 +691,21 @@ static void tg_service_queue_add(struct throtl_grp *tg)
leftmost);
}

static void __throtl_enqueue_tg(struct throtl_grp *tg)
{
tg_service_queue_add(tg);
tg->flags |= THROTL_TG_PENDING;
tg->service_queue.parent_sq->nr_pending++;
}

static void throtl_enqueue_tg(struct throtl_grp *tg)
{
if (!(tg->flags & THROTL_TG_PENDING))
__throtl_enqueue_tg(tg);
}

static void __throtl_dequeue_tg(struct throtl_grp *tg)
{
throtl_rb_erase(&tg->rb_node, tg->service_queue.parent_sq);
tg->flags &= ~THROTL_TG_PENDING;
if (!(tg->flags & THROTL_TG_PENDING)) {
tg_service_queue_add(tg);
tg->flags |= THROTL_TG_PENDING;
tg->service_queue.parent_sq->nr_pending++;
}
}

static void throtl_dequeue_tg(struct throtl_grp *tg)
{
if (tg->flags & THROTL_TG_PENDING)
__throtl_dequeue_tg(tg);
if (tg->flags & THROTL_TG_PENDING) {
throtl_rb_erase(&tg->rb_node, tg->service_queue.parent_sq);
tg->flags &= ~THROTL_TG_PENDING;
}
}

/* Call with queue lock held */
Expand Down

0 comments on commit 2937967

Please sign in to comment.