blk-ioc.c (c51ca6cf545bc51ad38bd50816bde37c647d608d) blk-ioc.c (bd166ef183c263c5ced656d49ef19c7da4adc774)
1/*
2 * Functions related to io context handling
3 */
4#include <linux/kernel.h>
5#include <linux/module.h>
6#include <linux/init.h>
7#include <linux/bio.h>
8#include <linux/blkdev.h>

--- 29 unchanged lines hidden (view full) ---

38/* Exit an icq. Called with both ioc and q locked. */
39static void ioc_exit_icq(struct io_cq *icq)
40{
41 struct elevator_type *et = icq->q->elevator->type;
42
43 if (icq->flags & ICQ_EXITED)
44 return;
45
1/*
2 * Functions related to io context handling
3 */
4#include <linux/kernel.h>
5#include <linux/module.h>
6#include <linux/init.h>
7#include <linux/bio.h>
8#include <linux/blkdev.h>

--- 29 unchanged lines hidden (view full) ---

38/* Exit an icq. Called with both ioc and q locked. */
39static void ioc_exit_icq(struct io_cq *icq)
40{
41 struct elevator_type *et = icq->q->elevator->type;
42
43 if (icq->flags & ICQ_EXITED)
44 return;
45
46 if (et->ops.sq.elevator_exit_icq_fn)
46 if (et->uses_mq && et->ops.mq.exit_icq)
47 et->ops.mq.exit_icq(icq);
48 else if (!et->uses_mq && et->ops.sq.elevator_exit_icq_fn)
47 et->ops.sq.elevator_exit_icq_fn(icq);
48
49 icq->flags |= ICQ_EXITED;
50}
51
52/* Release an icq. Called with both ioc and q locked. */
53static void ioc_destroy_icq(struct io_cq *icq)
54{

--- 323 unchanged lines hidden (view full) ---

378
379 /* lock both q and ioc and try to link @icq */
380 spin_lock_irq(q->queue_lock);
381 spin_lock(&ioc->lock);
382
383 if (likely(!radix_tree_insert(&ioc->icq_tree, q->id, icq))) {
384 hlist_add_head(&icq->ioc_node, &ioc->icq_list);
385 list_add(&icq->q_node, &q->icq_list);
49 et->ops.sq.elevator_exit_icq_fn(icq);
50
51 icq->flags |= ICQ_EXITED;
52}
53
54/* Release an icq. Called with both ioc and q locked. */
55static void ioc_destroy_icq(struct io_cq *icq)
56{

--- 323 unchanged lines hidden (view full) ---

380
381 /* lock both q and ioc and try to link @icq */
382 spin_lock_irq(q->queue_lock);
383 spin_lock(&ioc->lock);
384
385 if (likely(!radix_tree_insert(&ioc->icq_tree, q->id, icq))) {
386 hlist_add_head(&icq->ioc_node, &ioc->icq_list);
387 list_add(&icq->q_node, &q->icq_list);
386 if (et->ops.sq.elevator_init_icq_fn)
388 if (et->uses_mq && et->ops.mq.init_icq)
389 et->ops.mq.init_icq(icq);
390 else if (!et->uses_mq && et->ops.sq.elevator_init_icq_fn)
387 et->ops.sq.elevator_init_icq_fn(icq);
388 } else {
389 kmem_cache_free(et->icq_cache, icq);
390 icq = ioc_lookup_icq(ioc, q);
391 if (!icq)
392 printk(KERN_ERR "cfq: icq link failed!\n");
393 }
394

--- 13 unchanged lines hidden ---
391 et->ops.sq.elevator_init_icq_fn(icq);
392 } else {
393 kmem_cache_free(et->icq_cache, icq);
394 icq = ioc_lookup_icq(ioc, q);
395 if (!icq)
396 printk(KERN_ERR "cfq: icq link failed!\n");
397 }
398

--- 13 unchanged lines hidden ---