Lines Matching refs:icq

37 	struct io_cq *icq = container_of(head, struct io_cq, __rcu_head);
39 kmem_cache_free(icq->__rcu_icq_cache, icq);
43 * Exit an icq. Called with ioc locked for blk-mq, and with both ioc
46 static void ioc_exit_icq(struct io_cq *icq)
48 struct elevator_type *et = icq->q->elevator->type;
50 if (icq->flags & ICQ_EXITED)
54 et->ops.exit_icq(icq);
56 icq->flags |= ICQ_EXITED;
61 struct io_cq *icq;
64 hlist_for_each_entry(icq, &ioc->icq_list, ioc_node)
65 ioc_exit_icq(icq);
70 * Release an icq. Called with ioc locked for blk-mq, and with both ioc
73 static void ioc_destroy_icq(struct io_cq *icq)
75 struct io_context *ioc = icq->ioc;
76 struct request_queue *q = icq->q;
82 if (icq->flags & ICQ_DESTROYED)
85 radix_tree_delete(&ioc->icq_tree, icq->q->id);
86 hlist_del_init(&icq->ioc_node);
87 list_del_init(&icq->q_node);
90 * Both setting lookup hint to and clearing it from @icq are done
91 * under queue_lock. If it's not pointing to @icq now, it never
94 if (rcu_access_pointer(ioc->icq_hint) == icq)
97 ioc_exit_icq(icq);
100 * @icq->q might have gone away by the time RCU callback runs
101 * making it impossible to determine icq_cache. Record it in @icq.
103 icq->__rcu_icq_cache = et->icq_cache;
104 icq->flags |= ICQ_DESTROYED;
105 call_rcu(&icq->__rcu_head, icq_free_icq_rcu);
110 * dancing to unlink all icq's and then frees ioc.
119 struct io_cq *icq = hlist_entry(ioc->icq_list.first,
121 struct request_queue *q = icq->q;
124 ioc_destroy_icq(icq);
127 /* Make sure q and icq cannot be freed. */
135 ioc_destroy_icq(icq);
175 struct io_cq *icq =
182 spin_lock(&icq->ioc->lock);
183 ioc_destroy_icq(icq);
184 spin_unlock(&icq->ioc->lock);
327 struct io_cq *icq;
332 * icq's are indexed from @ioc using radix tree and hint pointer,
335 * find a icq which points to us, it's guaranteed to be valid.
338 icq = rcu_dereference(ioc->icq_hint);
339 if (icq && icq->q == q)
342 icq = radix_tree_lookup(&ioc->icq_tree, q->id);
343 if (icq && icq->q == q)
344 rcu_assign_pointer(ioc->icq_hint, icq); /* allowed to race */
346 icq = NULL;
349 return icq;
357 * Make sure io_cq linking @ioc and @q exists. If icq doesn't exist, they
367 struct io_cq *icq;
370 icq = kmem_cache_alloc_node(et->icq_cache, GFP_ATOMIC | __GFP_ZERO,
372 if (!icq)
376 kmem_cache_free(et->icq_cache, icq);
380 icq->ioc = ioc;
381 icq->q = q;
382 INIT_LIST_HEAD(&icq->q_node);
383 INIT_HLIST_NODE(&icq->ioc_node);
385 /* lock both q and ioc and try to link @icq */
389 if (likely(!radix_tree_insert(&ioc->icq_tree, q->id, icq))) {
390 hlist_add_head(&icq->ioc_node, &ioc->icq_list);
391 list_add(&icq->q_node, &q->icq_list);
393 et->ops.init_icq(icq);
395 kmem_cache_free(et->icq_cache, icq);
396 icq = ioc_lookup_icq(q);
397 if (!icq)
398 printk(KERN_ERR "cfq: icq link failed!\n");
404 return icq;
410 struct io_cq *icq = NULL;
431 icq = ioc_lookup_icq(q);
435 if (!icq) {
436 icq = ioc_create_icq(q);
437 if (!icq) {
442 return icq;