From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: tj@kernel.org, axboe@kernel.dk
Cc: baolin.wang@linux.alibaba.com, baolin.wang7@gmail.com,
linux-block@vger.kernel.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 7/8] blk-throttle: Open code __throtl_de/enqueue_tg()
Date: Thu, 8 Oct 2020 11:52:28 +0800 [thread overview]
Message-ID: <6a43ae990da3163204bae3ddedb6025d73b91545.1602128837.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1602128837.git.baolin.wang@linux.alibaba.com>
In-Reply-To: <cover.1602128837.git.baolin.wang@linux.alibaba.com>
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 <baolin.wang@linux.alibaba.com>
---
block/blk-throttle.c | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 38aed8b..fc5c14f 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -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 */
--
1.8.3.1
next prev parent reply other threads:[~2020-10-08 3:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-08 3:52 [PATCH v2 0/8] Some improvements for blk throttle Baolin Wang
2020-10-08 3:52 ` [PATCH v2 1/8] blk-throttle: Remove a meaningless parameter for throtl_downgrade_state() Baolin Wang
2020-10-08 3:52 ` [PATCH v2 2/8] blk-throttle: Avoid getting the current time if tg->last_finish_time is 0 Baolin Wang
2020-10-08 3:52 ` [PATCH v2 3/8] blk-throttle: Avoid tracking latency if low limit is invalid Baolin Wang
2020-10-08 3:52 ` [PATCH v2 4/8] blk-throttle: Fix IO hang for a corner case Baolin Wang
2020-10-08 3:52 ` [PATCH v2 5/8] blk-throttle: Move the list operation after list validation Baolin Wang
2020-10-08 3:52 ` [PATCH v2 6/8] blk-throttle: Move service tree validation out of the throtl_rb_first() Baolin Wang
2020-10-08 3:52 ` Baolin Wang [this message]
2020-10-08 3:52 ` [PATCH v2 8/8] blk-throttle: Re-use the throtl_set_slice_end() Baolin Wang
2020-10-08 14:02 ` [PATCH v2 0/8] Some improvements for blk throttle Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a43ae990da3163204bae3ddedb6025d73b91545.1602128837.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=baolin.wang7@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®