Skip to content

Commit

Permalink
blk-mq: Fix blk_mq_tagset_busy_iter() for shared tags
Browse files Browse the repository at this point in the history
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: e155b0c ("blk-mq: Use shared tags for shared sbitmap support")
Reported-by: Kashyap Desai <[email protected]>
Signed-off-by: John Garry <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Tested-by: Kashyap Desai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
John Garry authored and axboe committed Oct 21, 2021
1 parent 008f75a commit 0994c64
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions block/blk-mq-tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,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);
Expand Down

0 comments on commit 0994c64

Please sign in to comment.