diff options
author | Tejun Heo <tj@kernel.org> | 2011-12-13 18:33:40 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2011-12-13 18:33:40 -0500 |
commit | 1238033c79e92e5c315af12e45396f1a78c73dec (patch) | |
tree | 0f205155f811930f0cf43716e56fa57ea1f792b9 /block | |
parent | b50b636bce6293fa858cc7ff6c3ffe4920d90006 (diff) |
block, cfq: kill cic->key
Now that lazy paths are removed, cfqd_dead_key() is meaningless and
cic->q can be used whereever cic->key is used. Kill cic->key.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/cfq-iosched.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index ae7791a8ded9..3b07ce168780 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -472,22 +472,9 @@ static inline void cic_set_cfqq(struct cfq_io_context *cic, | |||
472 | cic->cfqq[is_sync] = cfqq; | 472 | cic->cfqq[is_sync] = cfqq; |
473 | } | 473 | } |
474 | 474 | ||
475 | #define CIC_DEAD_KEY 1ul | ||
476 | #define CIC_DEAD_INDEX_SHIFT 1 | ||
477 | |||
478 | static inline void *cfqd_dead_key(struct cfq_data *cfqd) | ||
479 | { | ||
480 | return (void *)(cfqd->queue->id << CIC_DEAD_INDEX_SHIFT | CIC_DEAD_KEY); | ||
481 | } | ||
482 | |||
483 | static inline struct cfq_data *cic_to_cfqd(struct cfq_io_context *cic) | 475 | static inline struct cfq_data *cic_to_cfqd(struct cfq_io_context *cic) |
484 | { | 476 | { |
485 | struct cfq_data *cfqd = cic->key; | 477 | return cic->q->elevator->elevator_data; |
486 | |||
487 | if (unlikely((unsigned long) cfqd & CIC_DEAD_KEY)) | ||
488 | return NULL; | ||
489 | |||
490 | return cfqd; | ||
491 | } | 478 | } |
492 | 479 | ||
493 | /* | 480 | /* |
@@ -2679,10 +2666,8 @@ static void cfq_cic_free(struct cfq_io_context *cic) | |||
2679 | static void cfq_release_cic(struct cfq_io_context *cic) | 2666 | static void cfq_release_cic(struct cfq_io_context *cic) |
2680 | { | 2667 | { |
2681 | struct io_context *ioc = cic->ioc; | 2668 | struct io_context *ioc = cic->ioc; |
2682 | unsigned long dead_key = (unsigned long) cic->key; | ||
2683 | 2669 | ||
2684 | BUG_ON(!(dead_key & CIC_DEAD_KEY)); | 2670 | radix_tree_delete(&ioc->radix_root, cic->q->id); |
2685 | radix_tree_delete(&ioc->radix_root, dead_key >> CIC_DEAD_INDEX_SHIFT); | ||
2686 | hlist_del(&cic->cic_list); | 2671 | hlist_del(&cic->cic_list); |
2687 | cfq_cic_free(cic); | 2672 | cfq_cic_free(cic); |
2688 | } | 2673 | } |
@@ -2726,7 +2711,6 @@ static void cfq_exit_cic(struct cfq_io_context *cic) | |||
2726 | struct io_context *ioc = cic->ioc; | 2711 | struct io_context *ioc = cic->ioc; |
2727 | 2712 | ||
2728 | list_del_init(&cic->queue_list); | 2713 | list_del_init(&cic->queue_list); |
2729 | cic->key = cfqd_dead_key(cfqd); | ||
2730 | 2714 | ||
2731 | /* | 2715 | /* |
2732 | * Both setting lookup hint to and clearing it from @cic are done | 2716 | * Both setting lookup hint to and clearing it from @cic are done |
@@ -2982,6 +2966,7 @@ cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct io_context *ioc, | |||
2982 | static struct cfq_io_context * | 2966 | static struct cfq_io_context * |
2983 | cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc) | 2967 | cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc) |
2984 | { | 2968 | { |
2969 | struct request_queue *q = cfqd->queue; | ||
2985 | struct cfq_io_context *cic; | 2970 | struct cfq_io_context *cic; |
2986 | 2971 | ||
2987 | lockdep_assert_held(cfqd->queue->queue_lock); | 2972 | lockdep_assert_held(cfqd->queue->queue_lock); |
@@ -2996,11 +2981,11 @@ cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc) | |||
2996 | */ | 2981 | */ |
2997 | rcu_read_lock(); | 2982 | rcu_read_lock(); |
2998 | cic = rcu_dereference(ioc->ioc_data); | 2983 | cic = rcu_dereference(ioc->ioc_data); |
2999 | if (cic && cic->key == cfqd) | 2984 | if (cic && cic->q == q) |
3000 | goto out; | 2985 | goto out; |
3001 | 2986 | ||
3002 | cic = radix_tree_lookup(&ioc->radix_root, cfqd->queue->id); | 2987 | cic = radix_tree_lookup(&ioc->radix_root, cfqd->queue->id); |
3003 | if (cic && cic->key == cfqd) | 2988 | if (cic && cic->q == q) |
3004 | rcu_assign_pointer(ioc->ioc_data, cic); /* allowed to race */ | 2989 | rcu_assign_pointer(ioc->ioc_data, cic); /* allowed to race */ |
3005 | else | 2990 | else |
3006 | cic = NULL; | 2991 | cic = NULL; |
@@ -3040,7 +3025,6 @@ static int cfq_create_cic(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
3040 | goto out; | 3025 | goto out; |
3041 | 3026 | ||
3042 | cic->ioc = ioc; | 3027 | cic->ioc = ioc; |
3043 | cic->key = cfqd; | ||
3044 | cic->q = cfqd->queue; | 3028 | cic->q = cfqd->queue; |
3045 | 3029 | ||
3046 | /* lock both q and ioc and try to link @cic */ | 3030 | /* lock both q and ioc and try to link @cic */ |