From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>
Cc: linux-block@vger.kernel.org, Ming Lei <ming.lei@redhat.com>,
Yi Zhang <yi.zhang@redhat.com>
Subject: [PATCH 1/4] block: split wbt_init() into two parts
Date: Tue, 25 May 2021 16:04:39 +0800 [thread overview]
Message-ID: <20210525080442.1896417-2-ming.lei@redhat.com> (raw)
In-Reply-To: <20210525080442.1896417-1-ming.lei@redhat.com>
Split wbt_init() into wbt_alloc() and wbt_init(), and prepare for
moving wbt allocation into blk_alloc_queue().
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
block/blk-wbt.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 42aed0160f86..efff1232446f 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -809,7 +809,7 @@ static struct rq_qos_ops wbt_rqos_ops = {
#endif
};
-int wbt_init(struct request_queue *q)
+static int wbt_alloc(struct request_queue *q)
{
struct rq_wb *rwb;
int i;
@@ -832,7 +832,6 @@ int wbt_init(struct request_queue *q)
rwb->rqos.q = q;
rwb->last_comp = rwb->last_issue = jiffies;
rwb->win_nsec = RWB_WINDOW_NSEC;
- rwb->enable_state = WBT_STATE_ON_DEFAULT;
rwb->wc = 1;
rwb->rq_depth.default_depth = RWB_DEF_DEPTH;
@@ -842,6 +841,19 @@ int wbt_init(struct request_queue *q)
rq_qos_add(q, &rwb->rqos);
blk_stat_add_callback(q, rwb->cb);
+ return 0;
+}
+
+int wbt_init(struct request_queue *q)
+{
+ int ret = wbt_alloc(q);
+ struct rq_wb *rwb;
+
+ if (ret)
+ return ret;
+
+ rwb = RQWB(wbt_rq_qos(q));
+ rwb->enable_state = WBT_STATE_ON_DEFAULT;
rwb->min_lat_nsec = wbt_default_latency_nsec(q);
wbt_queue_depth_changed(&rwb->rqos);
--
2.29.2
next prev parent reply other threads:[~2021-05-25 8:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 8:04 [PATCH 0/4] block: fix race between adding wbt and normal IO Ming Lei
2021-05-25 8:04 ` Ming Lei [this message]
2021-06-04 0:32 ` [PATCH 1/4] block: split wbt_init() into two parts Bart Van Assche
2021-05-25 8:04 ` [PATCH 2/4] block: move wbt allocation into blk_alloc_queue Ming Lei
2021-06-04 0:44 ` Bart Van Assche
2021-06-04 1:22 ` Ming Lei
2021-05-25 8:04 ` [PATCH 3/4] block: reuse wbt_set_min_lat for setting wbt->min_lat_nsec Ming Lei
2021-05-25 8:04 ` [PATCH 4/4] block: mark queue init done at the end of blk_register_queue Ming Lei
2021-06-04 0:03 ` [PATCH 0/4] block: fix race between adding wbt and normal IO Ming Lei
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=20210525080442.1896417-2-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=yi.zhang@redhat.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).