diff options
-rw-r--r-- | block/cfq-iosched.c | 26 | ||||
-rw-r--r-- | include/linux/iocontext.h | 1 |
2 files changed, 5 insertions, 22 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 */ |
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index 01e863128780..b2b75a54f252 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
@@ -20,7 +20,6 @@ enum { | |||
20 | }; | 20 | }; |
21 | 21 | ||
22 | struct cfq_io_context { | 22 | struct cfq_io_context { |
23 | void *key; | ||
24 | struct request_queue *q; | 23 | struct request_queue *q; |
25 | 24 | ||
26 | struct cfq_queue *cfqq[2]; | 25 | struct cfq_queue *cfqq[2]; |