linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai3@huawei.com>
To: <hch@infradead.org>, <tj@kernel.org>, <axboe@kernel.dk>
Cc: <cgroups@vger.kernel.org>, <linux-block@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <yukuai3@huawei.com>,
	<yi.zhang@huawei.com>
Subject: [PATCH 2/4] blk-throtl: don't warn in tg_drain_bios()
Date: Sat, 27 Nov 2021 18:10:57 +0800	[thread overview]
Message-ID: <20211127101059.477405-3-yukuai3@huawei.com> (raw)
In-Reply-To: <20211127101059.477405-1-yukuai3@huawei.com>

tg_drain_bios() will iterate until throtl_rb_first() return NULL,
don't warn in such situation.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/blk-throttle.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 230e300c5856..25822c88bea1 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -497,12 +497,13 @@ static void throtl_pd_free(struct blkg_policy_data *pd)
 }
 
 static struct throtl_grp *
-throtl_rb_first(struct throtl_service_queue *parent_sq)
+throtl_rb_first(struct throtl_service_queue *parent_sq, bool warn)
 {
 	struct rb_node *n;
 
 	n = rb_first_cached(&parent_sq->pending_tree);
-	WARN_ON_ONCE(!n);
+	if (warn)
+		WARN_ON_ONCE(!n);
 	if (!n)
 		return NULL;
 	return rb_entry_tg(n);
@@ -520,7 +521,7 @@ static void update_min_dispatch_time(struct throtl_service_queue *parent_sq)
 {
 	struct throtl_grp *tg;
 
-	tg = throtl_rb_first(parent_sq);
+	tg = throtl_rb_first(parent_sq, true);
 	if (!tg)
 		return;
 
@@ -1089,7 +1090,7 @@ static int throtl_select_dispatch(struct throtl_service_queue *parent_sq)
 		if (!parent_sq->nr_pending)
 			break;
 
-		tg = throtl_rb_first(parent_sq);
+		tg = throtl_rb_first(parent_sq, true);
 		if (!tg)
 			break;
 
@@ -2266,7 +2267,7 @@ static void tg_drain_bios(struct throtl_service_queue *parent_sq)
 {
 	struct throtl_grp *tg;
 
-	while ((tg = throtl_rb_first(parent_sq))) {
+	while ((tg = throtl_rb_first(parent_sq, false))) {
 		struct throtl_service_queue *sq = &tg->service_queue;
 		struct bio *bio;
 
-- 
2.31.1


  parent reply	other threads:[~2021-11-27 10:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27 10:10 [PATCH 0/4] cancel all throttled bios in del_gendisk() Yu Kuai
2021-11-27 10:10 ` [PATCH 1/4] Revert "blk-throttle: remove tg_drain_bios" Yu Kuai
2021-11-29 11:45   ` Christoph Hellwig
2021-11-27 10:10 ` Yu Kuai [this message]
2021-11-29 11:46   ` [PATCH 2/4] blk-throtl: don't warn in tg_drain_bios() Christoph Hellwig
2021-11-27 10:10 ` [PATCH 3/4] blk-throtl: introduce blk_throtl_cancel_bios() Yu Kuai
2021-11-29 11:47   ` Christoph Hellwig
2021-11-29 13:58     ` yukuai (C)
2021-11-27 10:10 ` [PATCH 4/4] block: cancel all throttled bios in del_gendisk() Yu Kuai
  -- strict thread matches above, loose matches on Subject: below --
2021-09-22 12:51 [PATCH 0/4] cancel all throttled bios in blk_cleanup_queue() Yu Kuai
2021-09-22 12:51 ` [PATCH 2/4] blk-throtl: don't warn in tg_drain_bios() Yu Kuai

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=20211127101059.477405-3-yukuai3@huawei.com \
    --to=yukuai3@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=yi.zhang@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).