Lines Matching defs:hctx

61 bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
63 if (!test_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state) &&
64 !test_and_set_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state))
65 atomic_inc(&hctx->tags->active_queues);
94 void __blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)
96 struct blk_mq_tags *tags = hctx->tags;
98 if (!test_and_clear_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state))
110 static inline bool hctx_may_queue(struct blk_mq_hw_ctx *hctx,
115 if (!hctx || !(hctx->flags & BLK_MQ_F_TAG_SHARED))
117 if (!test_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state))
126 users = atomic_read(&hctx->tags->active_queues);
134 return atomic_read(&hctx->nr_active) < depth;
175 static int __bt_get(struct blk_mq_hw_ctx *hctx, struct blk_mq_bitmap_tags *bt,
181 if (!hctx_may_queue(hctx, bt))
219 struct blk_mq_hw_ctx *hctx)
224 if (!hctx)
227 wait_index = atomic_read(&hctx->wait_index);
229 bt_index_atomic_inc(&hctx->wait_index);
235 struct blk_mq_hw_ctx *hctx,
242 tag = __bt_get(hctx, bt, last_tag);
249 bs = bt_wait_ptr(bt, hctx);
253 tag = __bt_get(hctx, bt, last_tag);
262 data->hctx = data->q->mq_ops->map_queue(data->q,
265 bt = &data->hctx->tags->breserved_tags;
268 hctx = data->hctx;
269 bt = &hctx->tags->bitmap_tags;
272 bs = bt_wait_ptr(bt, hctx);
283 tag = bt_get(data, &data->hctx->tags->bitmap_tags, data->hctx,
286 return tag + data->hctx->tags->nr_reserved_tags;
295 if (unlikely(!data->hctx->tags->nr_reserved_tags)) {
300 tag = bt_get(data, &data->hctx->tags->breserved_tags, NULL, &zero);
378 void blk_mq_put_tag(struct blk_mq_hw_ctx *hctx, unsigned int tag,
381 struct blk_mq_tags *tags = hctx->tags;
392 static void bt_for_each(struct blk_mq_hw_ctx *hctx,
405 rq = blk_mq_tag_to_rq(hctx->tags, off + bit);
406 if (rq->q == hctx->queue)
407 fn(hctx, rq, data, reserved);
414 void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn,
417 struct blk_mq_tags *tags = hctx->tags;
420 bt_for_each(hctx, &tags->breserved_tags, 0, fn, priv, true);
421 bt_for_each(hctx, &tags->bitmap_tags, tags->nr_reserved_tags, fn, priv,