block/blk-mq-tag.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 32e8dbb..8d4b4f0 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -232,6 +232,27 @@ static struct bt_wait_state *bt_wait_ptr(struct blk_mq_bitmap_tags *bt, return bs; } +static unsigned int bt_unused_tags(struct blk_mq_bitmap_tags *bt); + +static void print_hctx_tags_usage(struct blk_mq_hw_ctx *hctx) +{ + unsigned int free, res; + struct blk_mq_tags *tags = hctx->tags; + + if (!tags) + return; + + printk("queue_num=%d, nr_tags=%u, reserved_tags=%u, bits_per_word=%u\n", + hctx->queue_num, tags->nr_tags, tags->nr_reserved_tags, + tags->bitmap_tags.bits_per_word); + + free = bt_unused_tags(&tags->bitmap_tags); + res = bt_unused_tags(&tags->breserved_tags); + + printk("nr_free=%u, nr_reserved=%u\n", free, res); + printk("active_queues=%u\n", atomic_read(&tags->active_queues)); +} + static int bt_get(struct blk_mq_alloc_data *data, struct blk_mq_bitmap_tags *bt, struct blk_mq_hw_ctx *hctx, @@ -245,6 +266,10 @@ static int bt_get(struct blk_mq_alloc_data *data, if (tag != -1) return tag; + printk("\n%s: __bt_get() returned -1\n", __func__); + print_hctx_tags_usage(hctx); + dump_stack(); + if (!(data->gfp & __GFP_WAIT)) return -1; @@ -256,6 +281,9 @@ static int bt_get(struct blk_mq_alloc_data *data, if (tag != -1) break; + printk("%s: __bt_get() _still_ returned -1\n", __func__); + print_hctx_tags_usage(hctx); + /* * We're out of tags on this hardware queue, kick any * pending IO submits before going to sleep waiting for