Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / block / bfq-ioc.c
blobaf791d29fce0b940343ef2098d5674e61e91c7d8
1 /*
2 * BFQ: I/O context handling.
4 * Based on ideas and code from CFQ:
5 * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
7 * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
8 * Paolo Valente <paolo.valente@unimore.it>
9 */
11 /**
12 * icq_to_bic - convert iocontext queue structure to bfq_io_cq.
13 * @icq: the iocontext queue.
15 static inline struct bfq_io_cq *icq_to_bic(struct io_cq *icq)
17 /* bic->icq is the first member, %NULL will convert to %NULL */
18 return container_of(icq, struct bfq_io_cq, icq);
21 /**
22 * bfq_bic_lookup - search into @ioc a bic associated to @bfqd.
23 * @bfqd: the lookup key.
24 * @ioc: the io_context of the process doing I/O.
26 * Queue lock must be held.
28 static inline struct bfq_io_cq *bfq_bic_lookup(struct bfq_data *bfqd,
29 struct io_context *ioc)
31 if(ioc)
32 return icq_to_bic(ioc_lookup_icq(ioc, bfqd->queue));
33 return NULL;