From: Chengming Zhou <chengming.zhou@linux.dev>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: hch@lst.de, tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk,
yukuai3@huawei.com, lukas.bulwahn@gmail.com,
cgroups@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
yangerkun@huawei.com
Subject: Re: [PATCH -next v2 1/6] blk-wbt: fix that wbt can't be disabled by default
Date: Fri, 12 May 2023 17:59:43 +0800 [thread overview]
Message-ID: <fecc63de-9477-cad4-79f3-bdb1f1e3ab5f@linux.dev> (raw)
In-Reply-To: <20230512093554.911753-2-yukuai1@huaweicloud.com>
On 2023/5/12 17:35, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
>
> commit b11d31ae01e6 ("blk-wbt: remove unnecessary check in
> wbt_enable_default()") removes the checking of CONFIG_BLK_WBT_MQ by
> mistake, which is used to control enable or disable wbt by default.
>
> Fix the problem by adding back the checking. This patch also do a litter
> cleanup to make related code more readable.
>
> Fixes: b11d31ae01e6 ("blk-wbt: remove unnecessary check in wbt_enable_default()")
> Reported-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> Link: https://lore.kernel.org/lkml/CAKXUXMzfKq_J9nKHGyr5P5rvUETY4B-fxoQD4sO+NYjFOfVtZA@mail.gmail.com/t/
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> block/blk-wbt.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/block/blk-wbt.c b/block/blk-wbt.c
> index e49a48684532..9ec2a2f1eda3 100644
> --- a/block/blk-wbt.c
> +++ b/block/blk-wbt.c
> @@ -730,14 +730,16 @@ void wbt_enable_default(struct gendisk *disk)
> {
> struct request_queue *q = disk->queue;
> struct rq_qos *rqos;
> - bool disable_flag = q->elevator &&
> - test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags);
> + bool enable = IS_ENABLED(CONFIG_BLK_WBT_MQ);
> +
> + if (q->elevator &&
> + test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags))
> + enable = false;
Why not just early return, so "enable" is not needed at all?
I have another question that CONFIG_BLK_WBT_MQ is not much flexible, can we
just get rid of it? (I'm not sure when to disable it in the config)
Thanks.
>
> /* Throttling already enabled? */
> rqos = wbt_rq_qos(q);
> if (rqos) {
> - if (!disable_flag &&
> - RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT)
> + if (enable && RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT)
> RQWB(rqos)->enable_state = WBT_STATE_ON_DEFAULT;
> return;
> }
> @@ -746,7 +748,7 @@ void wbt_enable_default(struct gendisk *disk)
> if (!blk_queue_registered(q))
> return;
>
> - if (queue_is_mq(q) && !disable_flag)
> + if (queue_is_mq(q) && enable)
> wbt_init(disk);
> }
> EXPORT_SYMBOL_GPL(wbt_enable_default);
next prev parent reply other threads:[~2023-05-12 9:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 9:35 [PATCH -next v2 0/6] blk-wbt: minor fix and cleanup Yu Kuai
2023-05-12 9:35 ` [PATCH -next v2 1/6] blk-wbt: fix that wbt can't be disabled by default Yu Kuai
2023-05-12 9:59 ` Chengming Zhou [this message]
2023-05-12 14:57 ` Christoph Hellwig
2023-05-12 9:35 ` [PATCH -next v2 2/6] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
2023-05-12 14:57 ` Christoph Hellwig
2023-05-12 9:35 ` [PATCH -next v2 3/6] blk-wbt: remove dead code to handle wbt enable/disable with io inflight Yu Kuai
[not found] ` <20230512093554.911753-1-yukuai1-XF6JlduFytWkHkcT6e4Xnw@public.gmane.org>
2023-05-12 9:35 ` [PATCH -next v2 4/6] blk-wbt: cleanup rwb_enabled() and wbt_disabled() Yu Kuai
[not found] ` <20230512093554.911753-5-yukuai1-XF6JlduFytWkHkcT6e4Xnw@public.gmane.org>
2023-05-12 14:58 ` Christoph Hellwig
2023-05-12 9:35 ` [PATCH -next v2 5/6] blk-iocost: move wbt_enable/disable_default() out of spinlock Yu Kuai
2023-05-12 14:58 ` Christoph Hellwig
2023-05-12 9:35 ` [PATCH -next v2 6/6] blk-sysfs: add a new attr_group for blk_mq Yu Kuai
[not found] ` <20230512093554.911753-7-yukuai1-XF6JlduFytWkHkcT6e4Xnw@public.gmane.org>
2023-05-26 9:38 ` Yu Kuai
2023-05-26 12:34 ` Christoph Hellwig
2023-05-12 14:58 ` [PATCH -next v2 0/6] blk-wbt: minor fix and cleanup Jens Axboe
[not found] ` <2b18e6ed-bce0-44f5-5ec4-8903f3c85cfe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2023-05-22 12:00 ` Linux regression tracking (Thorsten Leemhuis)
[not found] ` <5d53e634-33c2-e040-3c34-6c36e32eed81-rCxcAJFjeRkk+I/owrrOrA@public.gmane.org>
2023-05-22 12:12 ` 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=fecc63de-9477-cad4-79f3-bdb1f1e3ab5f@linux.dev \
--to=chengming.zhou@linux.dev \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=tj@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.com \
--cc=yukuai3@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