diff mbox series

答复: [PATCH v2 1/2] block: Call .limit_depth() after .hctx has been set

Message ID 57b38aac30d94bb1a167904db292d1fc@BJMBX02.spreadtrum.com (mailing list archive)
State New
Headers show
Series 答复: [PATCH v2 1/2] block: Call .limit_depth() after .hctx has been set | expand

Commit Message

牛志国 (Zhiguo Niu) July 2, 2024, 8:39 a.m. UTC
-----邮件原件-----
发件人: Bart Van Assche <bvanassche@acm.org> 
发送时间: 2024年5月10日 1:02
收件人: Jens Axboe <axboe@kernel.dk>
抄送: linux-block@vger.kernel.org; Christoph Hellwig <hch@lst.de>; Bart Van Assche <bvanassche@acm.org>; Damien Le Moal <dlemoal@kernel.org>; 牛志国 (Zhiguo Niu) <Zhiguo.Niu@unisoc.com>
主题: [PATCH v2 1/2] block: Call .limit_depth() after .hctx has been set


注意: 这封邮件来自于外部。除非你确定邮件内容安全,否则不要点击任何链接和附件。
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.



Call .limit_depth() after data->hctx has been set such that data->hctx can be used in .limit_depth() implementations.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Zhiguo Niu <zhiguo.niu@unisoc.com>
Fixes: 07757588e507 ("block/mq-deadline: Reserve 25% of scheduler tags for synchronous requests")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-mq.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Tested-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Thanks!
        if (q->elevator) {
                /*
                 * All requests use scheduler tags when an I/O scheduler is @@ -469,13 +473,9 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data)
                        if (ops->limit_depth)
                                ops->limit_depth(data->cmd_flags, data);
                }
-       }
-
-retry:
-       data->ctx = blk_mq_get_ctx(q);
-       data->hctx = blk_mq_map_queue(q, data->cmd_flags, data->ctx);
-       if (!(data->rq_flags & RQF_SCHED_TAGS))
+       } else {
                blk_mq_tag_busy(data->hctx);
+       }

        if (data->flags & BLK_MQ_REQ_RESERVED)
                data->rq_flags |= RQF_RESV;
diff mbox series

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c index 9f677ea85a52..a6310a550b78 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -448,6 +448,10 @@  static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data)
        if (data->cmd_flags & REQ_NOWAIT)
                data->flags |= BLK_MQ_REQ_NOWAIT;

+retry:
+       data->ctx = blk_mq_get_ctx(q);
+       data->hctx = blk_mq_map_queue(q, data->cmd_flags, data->ctx);
+
Hi Bart,
I tested basic function about these serial patches and results is pass, and no warning report after setting async_depth value by sysfs, But there is a little question here, if do "retry", the following if case will be re-run also, so 
Is there something wrong with this or can it be improved?  Otherwise