diff options
author | Tejun Heo <tj@kernel.org> | 2011-12-14 00:33:42 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2011-12-14 00:33:42 +0100 |
commit | 47fdd4ca96bf4b28ac4d05d7a6e382df31d3d758 (patch) | |
tree | bcb928575b66511345b00102a7e8cace84526e3e /block/cfq-iosched.c | |
parent | a612fddf0d8090f2877305c9168b6c1a34fb5d90 (diff) | |
download | linux-3.10-47fdd4ca96bf4b28ac4d05d7a6e382df31d3d758.tar.gz linux-3.10-47fdd4ca96bf4b28ac4d05d7a6e382df31d3d758.tar.bz2 linux-3.10-47fdd4ca96bf4b28ac4d05d7a6e382df31d3d758.zip |
block, cfq: move io_cq lookup to blk-ioc.c
Now that all io_cq related data structures are in block core layer,
io_cq lookup can be moved from cfq-iosched.c to blk-ioc.c.
Lookup logic from cfq_cic_lookup() is moved to ioc_lookup_icq() with
parameter return type changes (cfqd -> request_queue, cfq_io_cq ->
io_cq) and cfq_cic_lookup() becomes thin wrapper around
cfq_cic_lookup().
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 48 |
1 files changed, 8 insertions, 40 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 9bc5ecc1b33..048fa699adf 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -468,7 +468,6 @@ static inline int cfqg_busy_async_queues(struct cfq_data *cfqd, static void cfq_dispatch_insert(struct request_queue *, struct request *); static struct cfq_queue *cfq_get_queue(struct cfq_data *, bool, struct io_context *, gfp_t); -static struct cfq_io_cq *cfq_cic_lookup(struct cfq_data *, struct io_context *); static inline struct cfq_io_cq *icq_to_cic(struct io_cq *icq) { @@ -476,6 +475,14 @@ static inline struct cfq_io_cq *icq_to_cic(struct io_cq *icq) return container_of(icq, struct cfq_io_cq, icq); } +static inline struct cfq_io_cq *cfq_cic_lookup(struct cfq_data *cfqd, + struct io_context *ioc) +{ + if (ioc) + return icq_to_cic(ioc_lookup_icq(ioc, cfqd->queue)); + return NULL; +} + static inline struct cfq_queue *cic_to_cfqq(struct cfq_io_cq *cic, bool is_sync) { return cic->cfqq[is_sync]; @@ -2971,45 +2978,6 @@ cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct io_context *ioc, } /** - * cfq_cic_lookup - lookup cfq_io_cq - * @cfqd: the associated cfq_data - * @ioc: the associated io_context - * - * Look up cfq_io_cq associated with @cfqd - @ioc pair. Must be called - * with queue_lock held. - */ -static struct cfq_io_cq * -cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc) -{ - struct request_queue *q = cfqd->queue; - struct io_cq *icq; - - lockdep_assert_held(cfqd->queue->queue_lock); - if (unlikely(!ioc)) - return NULL; - - /* - * icq's are indexed from @ioc using radix tree and hint pointer, - * both of which are protected with RCU. All removals are done - * holding both q and ioc locks, and we're holding q lock - if we - * find a icq which points to us, it's guaranteed to be valid. - */ - rcu_read_lock(); - icq = rcu_dereference(ioc->icq_hint); - if (icq && icq->q == q) - goto out; - - icq = radix_tree_lookup(&ioc->icq_tree, cfqd->queue->id); - if (icq && icq->q == q) - rcu_assign_pointer(ioc->icq_hint, icq); /* allowed to race */ - else - icq = NULL; -out: - rcu_read_unlock(); - return icq_to_cic(icq); -} - -/** * cfq_create_cic - create and link a cfq_io_cq * @cfqd: cfqd of interest * @gfp_mask: allocation mask |