linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] blk-mq: Fix blk_mq_tagset_busy_iter() for shared tags
@ 2021-10-18  9:41 John Garry
  2021-10-18 18:49 ` Kashyap Desai
  2021-10-21 14:21 ` Jens Axboe
  0 siblings, 2 replies; 7+ messages in thread
From: John Garry @ 2021-10-18  9:41 UTC (permalink / raw)
  To: axboe; +Cc: ming.lei, linux-block, linux-kernel, kashyap.desai, hare,
	John Garry

Since it is now possible for a tagset to share a single set of tags, the
iter function should not re-iter the tags for the count of #hw queues in
that case. Rather it should just iter once.

Fixes: e0fdf846c7bb ("blk-mq: Use shared tags for shared sbitmap support")
Reported-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
---
Diff to v1:
- Add Ming's RB tag

diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 72a2724a4eee..c943b6529619 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -378,9 +378,12 @@ 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)
 {
-	int i;
+	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 < tagset->nr_hw_queues; i++) {
+	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);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-13 13:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-18  9:41 [PATCH v2] blk-mq: Fix blk_mq_tagset_busy_iter() for shared tags John Garry
2021-10-18 18:49 ` Kashyap Desai
2021-10-21  8:08   ` John Garry
2021-10-21 14:21 ` Jens Axboe
2021-12-09 13:52   ` Kashyap Desai
2021-12-09 14:42     ` John Garry
2021-12-13 13:15       ` Kashyap Desai

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).