From patchwork Wed Aug 23 15:17:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13362741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48F61EE4993 for ; Wed, 23 Aug 2023 15:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231187AbjHWPT2 (ORCPT ); Wed, 23 Aug 2023 11:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233826AbjHWPT1 (ORCPT ); Wed, 23 Aug 2023 11:19:27 -0400 Received: from out-18.mta0.migadu.com (out-18.mta0.migadu.com [IPv6:2001:41d0:1004:224b::12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B9BBE71 for ; Wed, 23 Aug 2023 08:18:57 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692803914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AqZNkS+a81hc+iMtsAHXvpxvEGTl1qxgb5RoMRXMYL4=; b=PzJYIuzFjqEmAVZDNBUmkYNUZdjAVz8QuaNz/S7YNBkU9R/hTDyxWsDpaarInCui3QpDDE 4gqtczDckM8NMz+w1UTw87claYfVpkJilFLJGLTi0fRT0qEqafshefl6lYw0jMGYu9O3Dy U9lk0D38y4CdVDcbV+XBpCaoDseI/Ok= From: chengming.zhou@linux.dev To: axboe@kernel.dk, ming.lei@redhat.com, bvanassche@acm.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: [PATCH v3 1/6] blk-mq-tag: support queue filter in bt_tags_iter() Date: Wed, 23 Aug 2023 23:17:58 +0800 Message-ID: <20230823151803.926382-2-chengming.zhou@linux.dev> In-Reply-To: <20230823151803.926382-1-chengming.zhou@linux.dev> References: <20230823151803.926382-1-chengming.zhou@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Chengming Zhou The only user of bt_for_each() is blk_mq_queue_tag_busy_iter(), which need to filter queue when iterate the tags. In preparation of removing bt_for_each(), support queue filter in bt_tags_iter(). Reviewed-by: Bart Van Assche Signed-off-by: Chengming Zhou --- block/blk-mq-tag.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index cc57e2dd9a0b..3cf3cf72cd54 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -329,6 +329,7 @@ struct bt_tags_iter_data { busy_tag_iter_fn *fn; void *data; unsigned int flags; + struct request_queue *q; }; #define BT_TAG_ITER_RESERVED (1 << 0) @@ -357,9 +358,13 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data) if (!rq) return true; + if (iter_data->q && iter_data->q != rq->q) + goto out; + if (!(iter_data->flags & BT_TAG_ITER_STARTED) || blk_mq_request_started(rq)) ret = iter_data->fn(rq, iter_data->data); +out: if (!iter_static_rqs) blk_mq_put_rq_ref(rq); return ret; From patchwork Wed Aug 23 15:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13362742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA1B9EE49B5 for ; Wed, 23 Aug 2023 15:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237006AbjHWPTa (ORCPT ); Wed, 23 Aug 2023 11:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237035AbjHWPT3 (ORCPT ); Wed, 23 Aug 2023 11:19:29 -0400 Received: from out-51.mta0.migadu.com (out-51.mta0.migadu.com [IPv6:2001:41d0:1004:224b::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87A9FE79 for ; Wed, 23 Aug 2023 08:18:59 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692803918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CgvuI/NS2vqDqGZXwijhCevGOtt6nlyfyFMMjG8wZxQ=; b=auCgTHbqg+h3wizmFE/31k77p1sbZOdZoFwHl1tci5WhOvRzMCXXHoLng/fQHQxijevNck J7ryclkbsl9lQ3MNwW+UCstRyzKc4YLEBdW+gKjX6hzoRjCw/7vZPRxqdYGwTLt7OnPuD8 usYjIlQu2nPVUPkxWEWA1anRYM8r4TE= From: chengming.zhou@linux.dev To: axboe@kernel.dk, ming.lei@redhat.com, bvanassche@acm.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: [PATCH v3 2/6] blk-mq-tag: introduce __blk_mq_tagset_busy_iter() Date: Wed, 23 Aug 2023 23:17:59 +0800 Message-ID: <20230823151803.926382-3-chengming.zhou@linux.dev> In-Reply-To: <20230823151803.926382-1-chengming.zhou@linux.dev> References: <20230823151803.926382-1-chengming.zhou@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Chengming Zhou For support of specified queue filter when iterating over a tagset, we introduce __blk_mq_tagset_busy_iter() here and all current users just set queue as NULL which means have no queue filter. Reviewed-by: Bart Van Assche Signed-off-by: Chengming Zhou --- block/blk-mq-tag.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 3cf3cf72cd54..dc4edde3c80a 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -381,15 +381,18 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data) * to continue iterating tags, false to stop. * @data: Will be passed as second argument to @fn. * @flags: BT_TAG_ITER_* + * @q: Only iterate over requests of this queue. */ static void bt_tags_for_each(struct blk_mq_tags *tags, struct sbitmap_queue *bt, - busy_tag_iter_fn *fn, void *data, unsigned int flags) + busy_tag_iter_fn *fn, void *data, unsigned int flags, + struct request_queue *q) { struct bt_tags_iter_data iter_data = { .tags = tags, .fn = fn, .data = data, .flags = flags, + .q = q, }; if (tags->rqs) @@ -397,14 +400,15 @@ static void bt_tags_for_each(struct blk_mq_tags *tags, struct sbitmap_queue *bt, } static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags, - busy_tag_iter_fn *fn, void *priv, unsigned int flags) + busy_tag_iter_fn *fn, void *priv, unsigned int flags, + struct request_queue *q) { WARN_ON_ONCE(flags & BT_TAG_ITER_RESERVED); if (tags->nr_reserved_tags) bt_tags_for_each(tags, &tags->breserved_tags, fn, priv, - flags | BT_TAG_ITER_RESERVED); - bt_tags_for_each(tags, &tags->bitmap_tags, fn, priv, flags); + flags | BT_TAG_ITER_RESERVED, q); + bt_tags_for_each(tags, &tags->bitmap_tags, fn, priv, flags, q); } /** @@ -422,7 +426,23 @@ static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags, void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn, void *priv) { - __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS); + __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS, NULL); +} + +static void __blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, + busy_tag_iter_fn *fn, void *priv, + struct request_queue *q) +{ + unsigned int flags = tagset->flags; + int i, nr_tags; + + nr_tags = blk_mq_is_shared_tags(flags) ? 1 : tagset->nr_hw_queues; + + for (i = 0; i < nr_tags; i++) { + if (tagset->tags && tagset->tags[i]) + __blk_mq_all_tag_iter(tagset->tags[i], fn, priv, + BT_TAG_ITER_STARTED, q); + } } /** @@ -441,16 +461,7 @@ void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn, void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, busy_tag_iter_fn *fn, void *priv) { - unsigned int flags = tagset->flags; - int i, nr_tags; - - nr_tags = blk_mq_is_shared_tags(flags) ? 1 : tagset->nr_hw_queues; - - for (i = 0; i < nr_tags; i++) { - if (tagset->tags && tagset->tags[i]) - __blk_mq_all_tag_iter(tagset->tags[i], fn, priv, - BT_TAG_ITER_STARTED); - } + __blk_mq_tagset_busy_iter(tagset, fn, priv, NULL); } EXPORT_SYMBOL(blk_mq_tagset_busy_iter); From patchwork Wed Aug 23 15:18:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13362745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1867FEE4993 for ; Wed, 23 Aug 2023 15:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235540AbjHWPUM (ORCPT ); Wed, 23 Aug 2023 11:20:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235642AbjHWPUL (ORCPT ); Wed, 23 Aug 2023 11:20:11 -0400 Received: from out-49.mta0.migadu.com (out-49.mta0.migadu.com [91.218.175.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B89D10F4 for ; Wed, 23 Aug 2023 08:19:43 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692803921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qOkjJ3FtCBU+dxJyXAZvEDlW/VuONF5jdxwoszMAsnU=; b=gmutHBAOYviuejKpSvbF8wgDAlsvn/A/DnMn6qPe9WPv4RFXqtrz0Z2sG6wAJMRnpxpEHm b8RLHUFeuO4+zu88hTPHmhYbUeIvA3+7NnlHoUke0bTtjaAJYocSTNBCQqckxFRKjlfy3R mq23OPGadNa+8Lud5zkw9QW/GkaM+l8= From: chengming.zhou@linux.dev To: axboe@kernel.dk, ming.lei@redhat.com, bvanassche@acm.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: [PATCH v3 3/6] blk-mq-tag: remove bt_for_each() Date: Wed, 23 Aug 2023 23:18:00 +0800 Message-ID: <20230823151803.926382-4-chengming.zhou@linux.dev> In-Reply-To: <20230823151803.926382-1-chengming.zhou@linux.dev> References: <20230823151803.926382-1-chengming.zhou@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Chengming Zhou Change the only user of bt_for_each() to use the introduced function __blk_mq_tagset_busy_iter() to specify queue filter when iterating. Since blk_mq_queue_tag_busy_iter() is only used to iterate over started requests, __blk_mq_tagset_busy_iter() already have BT_TAG_ITER_STARTED filter to iterate over started requests only, there should be no problem. Only one potential disadvantage I can see is that we lost the blk_mq_hw_queue_mapped() filter, which maybe not happen for now. Unmapped hctx was used to dynamically map or unmap when CPU hotplug, but we don't do this anymore, we always map all possible CPUs now. So it seems unmapped hctx may only happen if something wrong with driver's tagset map settings. Reviewed-by: Bart Van Assche Signed-off-by: Chengming Zhou --- block/blk-mq-tag.c | 99 +--------------------------------------------- 1 file changed, 1 insertion(+), 98 deletions(-) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index dc4edde3c80a..3ddc0c7b7f7e 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -241,14 +241,6 @@ void blk_mq_put_tags(struct blk_mq_tags *tags, int *tag_array, int nr_tags) tag_array, nr_tags); } -struct bt_iter_data { - struct blk_mq_hw_ctx *hctx; - struct request_queue *q; - busy_tag_iter_fn *fn; - void *data; - bool reserved; -}; - static struct request *blk_mq_find_and_get_req(struct blk_mq_tags *tags, unsigned int bitnr) { @@ -263,67 +255,6 @@ static struct request *blk_mq_find_and_get_req(struct blk_mq_tags *tags, return rq; } -static bool bt_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data) -{ - struct bt_iter_data *iter_data = data; - struct blk_mq_hw_ctx *hctx = iter_data->hctx; - struct request_queue *q = iter_data->q; - struct blk_mq_tag_set *set = q->tag_set; - struct blk_mq_tags *tags; - struct request *rq; - bool ret = true; - - if (blk_mq_is_shared_tags(set->flags)) - tags = set->shared_tags; - else - tags = hctx->tags; - - if (!iter_data->reserved) - bitnr += tags->nr_reserved_tags; - /* - * We can hit rq == NULL here, because the tagging functions - * test and set the bit before assigning ->rqs[]. - */ - rq = blk_mq_find_and_get_req(tags, bitnr); - if (!rq) - return true; - - if (rq->q == q && (!hctx || rq->mq_hctx == hctx)) - ret = iter_data->fn(rq, iter_data->data); - blk_mq_put_rq_ref(rq); - return ret; -} - -/** - * bt_for_each - iterate over the requests associated with a hardware queue - * @hctx: Hardware queue to examine. - * @q: Request queue to examine. - * @bt: sbitmap to examine. This is either the breserved_tags member - * or the bitmap_tags member of struct blk_mq_tags. - * @fn: Pointer to the function that will be called for each request - * associated with @hctx that has been assigned a driver tag. - * @fn will be called as follows: @fn(@hctx, rq, @data, @reserved) - * where rq is a pointer to a request. Return true to continue - * iterating tags, false to stop. - * @data: Will be passed as third argument to @fn. - * @reserved: Indicates whether @bt is the breserved_tags member or the - * bitmap_tags member of struct blk_mq_tags. - */ -static void bt_for_each(struct blk_mq_hw_ctx *hctx, struct request_queue *q, - struct sbitmap_queue *bt, busy_tag_iter_fn *fn, - void *data, bool reserved) -{ - struct bt_iter_data iter_data = { - .hctx = hctx, - .fn = fn, - .data = data, - .reserved = reserved, - .q = q, - }; - - sbitmap_for_each_set(&bt->sb, bt_iter, &iter_data); -} - struct bt_tags_iter_data { struct blk_mq_tags *tags; busy_tag_iter_fn *fn; @@ -520,35 +451,7 @@ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_tag_iter_fn *fn, if (!percpu_ref_tryget(&q->q_usage_counter)) return; - if (blk_mq_is_shared_tags(q->tag_set->flags)) { - struct blk_mq_tags *tags = q->tag_set->shared_tags; - struct sbitmap_queue *bresv = &tags->breserved_tags; - struct sbitmap_queue *btags = &tags->bitmap_tags; - - if (tags->nr_reserved_tags) - bt_for_each(NULL, q, bresv, fn, priv, true); - bt_for_each(NULL, q, btags, fn, priv, false); - } else { - struct blk_mq_hw_ctx *hctx; - unsigned long i; - - queue_for_each_hw_ctx(q, hctx, i) { - struct blk_mq_tags *tags = hctx->tags; - struct sbitmap_queue *bresv = &tags->breserved_tags; - struct sbitmap_queue *btags = &tags->bitmap_tags; - - /* - * If no software queues are currently mapped to this - * hardware queue, there's nothing to check - */ - if (!blk_mq_hw_queue_mapped(hctx)) - continue; - - if (tags->nr_reserved_tags) - bt_for_each(hctx, q, bresv, fn, priv, true); - bt_for_each(hctx, q, btags, fn, priv, false); - } - } + __blk_mq_tagset_busy_iter(q->tag_set, fn, priv, q); blk_queue_exit(q); } From patchwork Wed Aug 23 15:18:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13362757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA368EE49B0 for ; Wed, 23 Aug 2023 15:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231700AbjHWPYG (ORCPT ); Wed, 23 Aug 2023 11:24:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233122AbjHWPYG (ORCPT ); Wed, 23 Aug 2023 11:24:06 -0400 Received: from out-7.mta0.migadu.com (out-7.mta0.migadu.com [IPv6:2001:41d0:1004:224b::7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8C210C2 for ; Wed, 23 Aug 2023 08:23:47 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692803924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=39OjMOjb/826+Jg9MdvipvIXBUc1uSG53IpTEpDZxrU=; b=XAIXvIyAK1QhurQtGLr1P8iTvAjXecQQuUmN/33dBtlw3hRvPXwtsxdA2KPtOis6J/a/nz jYWYgh1ZJSOtDRVlaHPZlyVjL9clM5MiHdz36qV+MmsEQr8rKDITDgYa6SQQwC0B2OfrtW ybOaSvdBMyMynBXaFZNnkAFvyEXnd7k= From: chengming.zhou@linux.dev To: axboe@kernel.dk, ming.lei@redhat.com, bvanassche@acm.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: [PATCH v3 4/6] blk-mq: delete superfluous check in iterate callback Date: Wed, 23 Aug 2023 23:18:01 +0800 Message-ID: <20230823151803.926382-5-chengming.zhou@linux.dev> In-Reply-To: <20230823151803.926382-1-chengming.zhou@linux.dev> References: <20230823151803.926382-1-chengming.zhou@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Chengming Zhou The previous patch in this series changed the behavior of blk_mq_queue_tag_busy_iter() from iterating over all allocated tags into iterating over started requests only. Leave out the code from blk_mq_rq_inflight() that became superfluous because of this change. Reviewed-by: Bart Van Assche Signed-off-by: Chengming Zhou --- block/blk-mq.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 953f08354c8c..f1bafbae0a61 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1516,19 +1516,15 @@ EXPORT_SYMBOL(blk_mq_delay_kick_requeue_list); static bool blk_mq_rq_inflight(struct request *rq, void *priv) { + bool *busy = priv; + /* * If we find a request that isn't idle we know the queue is busy * as it's checked in the iter. * Return false to stop the iteration. */ - if (blk_mq_request_started(rq)) { - bool *busy = priv; - - *busy = true; - return false; - } - - return true; + *busy = true; + return false; } bool blk_mq_queue_inflight(struct request_queue *q) From patchwork Wed Aug 23 15:18:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13362744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAD7BEE49B2 for ; Wed, 23 Aug 2023 15:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237073AbjHWPTm (ORCPT ); Wed, 23 Aug 2023 11:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237077AbjHWPTl (ORCPT ); Wed, 23 Aug 2023 11:19:41 -0400 Received: from out-57.mta0.migadu.com (out-57.mta0.migadu.com [IPv6:2001:41d0:1004:224b::39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7C6F10F2 for ; Wed, 23 Aug 2023 08:19:07 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692803928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uUhSgwCQb7O6gk7TJeo0rwG5BnHIDWWkiQGv2AGrshg=; b=HwydVnYheOP3cQtYgRySTPuTVh/i+G7f37jsNRAoAii5dh33awMd78vYDQFJb96oQq7TUM UOtPywi62U0Lc3Re4KJ+/7GZNLzxQEgNXEhry/fvnOnbg4XTIP+l6441QctRpdM/aiaptN HOCAdzbbPHq4Z2np7lZD3ens1mVCafg= From: chengming.zhou@linux.dev To: axboe@kernel.dk, ming.lei@redhat.com, bvanassche@acm.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: [PATCH v3 5/6] blk-mq-tag: fix functions documentation Date: Wed, 23 Aug 2023 23:18:02 +0800 Message-ID: <20230823151803.926382-6-chengming.zhou@linux.dev> In-Reply-To: <20230823151803.926382-1-chengming.zhou@linux.dev> References: <20230823151803.926382-1-chengming.zhou@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Chengming Zhou There are some stale functions documentation in blk-mq-tag, since the prototype of busy_tag_iter_fn() has changed. Fix it as we're here. Fixes: 2dd6532e9591 ("blk-mq: Drop 'reserved' arg of busy_tag_iter_fn") Reviewed-by: Bart Van Assche Signed-off-by: Chengming Zhou --- block/blk-mq-tag.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 3ddc0c7b7f7e..0d42f3c4d76e 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -307,9 +307,9 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data) * @bt: sbitmap to examine. This is either the breserved_tags member * or the bitmap_tags member of struct blk_mq_tags. * @fn: Pointer to the function that will be called for each started - * request. @fn will be called as follows: @fn(rq, @data, - * @reserved) where rq is a pointer to a request. Return true - * to continue iterating tags, false to stop. + * request. @fn will be called as follows: @fn(rq, @data) where + * rq is a pointer to a request. Return true to continue iterating + * tags, false to stop. * @data: Will be passed as second argument to @fn. * @flags: BT_TAG_ITER_* * @q: Only iterate over requests of this queue. @@ -346,10 +346,9 @@ static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags, * blk_mq_all_tag_iter - iterate over all requests in a tag map * @tags: Tag map to iterate over. * @fn: Pointer to the function that will be called for each - * request. @fn will be called as follows: @fn(rq, @priv, - * reserved) where rq is a pointer to a request. 'reserved' - * indicates whether or not @rq is a reserved request. Return - * true to continue iterating tags, false to stop. + * request. @fn will be called as follows: @fn(rq, @priv) + * where rq is a pointer to a request. Return true to + * continue iterating tags, false to stop. * @priv: Will be passed as second argument to @fn. * * Caller has to pass the tag map from which requests are allocated. @@ -380,10 +379,9 @@ static void __blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, * blk_mq_tagset_busy_iter - iterate over all started requests in a tag set * @tagset: Tag set to iterate over. * @fn: Pointer to the function that will be called for each started - * request. @fn will be called as follows: @fn(rq, @priv, - * reserved) where rq is a pointer to a request. 'reserved' - * indicates whether or not @rq is a reserved request. Return - * true to continue iterating tags, false to stop. + * request. @fn will be called as follows: @fn(rq, @priv) + * where rq is a pointer to a request. Return true to + * continue iterating tags, false to stop. * @priv: Will be passed as second argument to @fn. * * We grab one request reference before calling @fn and release it after @@ -430,11 +428,9 @@ EXPORT_SYMBOL(blk_mq_tagset_wait_completed_request); * blk_mq_queue_tag_busy_iter - iterate over all requests with a driver tag * @q: Request queue to examine. * @fn: Pointer to the function that will be called for each request - * on @q. @fn will be called as follows: @fn(hctx, rq, @priv, - * reserved) where rq is a pointer to a request and hctx points - * to the hardware queue associated with the request. 'reserved' - * indicates whether or not @rq is a reserved request. - * @priv: Will be passed as third argument to @fn. + * on @q. @fn will be called as follows: @fn(rq, @priv) where rq + * is a pointer to a request. + * @priv: Will be passed as second argument to @fn. * * Note: if @q->tag_set is shared with other request queues then @fn will be * called for all requests on all queues that share that tag set and not only From patchwork Wed Aug 23 15:18:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13362743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 431D4EE49B0 for ; Wed, 23 Aug 2023 15:19:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237064AbjHWPTk (ORCPT ); Wed, 23 Aug 2023 11:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237071AbjHWPTk (ORCPT ); Wed, 23 Aug 2023 11:19:40 -0400 Received: from out-58.mta0.migadu.com (out-58.mta0.migadu.com [IPv6:2001:41d0:1004:224b::3a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7F8410F3 for ; Wed, 23 Aug 2023 08:19:07 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692803930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NnJXNO1JJg46Pgz2uwGFQLPJgin8MHVM0Z0oQpK/Ils=; b=eFJLHhd/F2DztuBt0cyRg6BIPbShiPNNTS3SfVTStzqddN3W/dZ0S6bQXgHcIvdh4VUlKV 0+BliTZk1isVG3Uo+hiNfCTfNJJhnftijFUysiij2S3kCEhGmD+9Z7AvkmuglTCgKwPFr5 riqq1MolxjyCbSUMVeZ4t+j4HtdK0qs= From: chengming.zhou@linux.dev To: axboe@kernel.dk, ming.lei@redhat.com, bvanassche@acm.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: [PATCH v3 6/6] blk-mq-tag: fix blk_mq_queue_tag_busy_iter() documentation Date: Wed, 23 Aug 2023 23:18:03 +0800 Message-ID: <20230823151803.926382-7-chengming.zhou@linux.dev> In-Reply-To: <20230823151803.926382-1-chengming.zhou@linux.dev> References: <20230823151803.926382-1-chengming.zhou@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Chengming Zhou The blk_mq_queue_tag_busy_iter() is only used to iterate over reqeusts of the specified queue, fix the documentation. Fixes: c7b1bf5cca76 ("blk-mq: Document the functions that iterate over requests") Signed-off-by: Chengming Zhou Reviewed-by: Bart Van Assche --- block/blk-mq-tag.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 0d42f3c4d76e..69b156750559 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -433,8 +433,7 @@ EXPORT_SYMBOL(blk_mq_tagset_wait_completed_request); * @priv: Will be passed as second argument to @fn. * * Note: if @q->tag_set is shared with other request queues then @fn will be - * called for all requests on all queues that share that tag set and not only - * for requests associated with @q. + * called only for requests associated with @q. */ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_tag_iter_fn *fn, void *priv)