Commit 1238033c79e92e5c315af12e45396f1a78c73dec

Authored by Tejun Heo
Committed by Jens Axboe
1 parent b50b636bce

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>

Showing 2 changed files with 5 additions and 22 deletions Side-by-side Diff

... ... @@ -472,22 +472,9 @@
472 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 475 static inline struct cfq_data *cic_to_cfqd(struct cfq_io_context *cic)
484 476 {
485   - struct cfq_data *cfqd = cic->key;
486   -
487   - if (unlikely((unsigned long) cfqd & CIC_DEAD_KEY))
488   - return NULL;
489   -
490   - return cfqd;
  477 + return cic->q->elevator->elevator_data;
491 478 }
492 479  
493 480 /*
494 481  
... ... @@ -2679,10 +2666,8 @@
2679 2666 static void cfq_release_cic(struct cfq_io_context *cic)
2680 2667 {
2681 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));
2685   - radix_tree_delete(&ioc->radix_root, dead_key >> CIC_DEAD_INDEX_SHIFT);
  2670 + radix_tree_delete(&ioc->radix_root, cic->q->id);
2686 2671 hlist_del(&cic->cic_list);
2687 2672 cfq_cic_free(cic);
2688 2673 }
... ... @@ -2726,7 +2711,6 @@
2726 2711 struct io_context *ioc = cic->ioc;
2727 2712  
2728 2713 list_del_init(&cic->queue_list);
2729   - cic->key = cfqd_dead_key(cfqd);
2730 2714  
2731 2715 /*
2732 2716 * Both setting lookup hint to and clearing it from @cic are done
... ... @@ -2982,6 +2966,7 @@
2982 2966 static struct cfq_io_context *
2983 2967 cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc)
2984 2968 {
  2969 + struct request_queue *q = cfqd->queue;
2985 2970 struct cfq_io_context *cic;
2986 2971  
2987 2972 lockdep_assert_held(cfqd->queue->queue_lock);
2988 2973  
... ... @@ -2996,11 +2981,11 @@
2996 2981 */
2997 2982 rcu_read_lock();
2998 2983 cic = rcu_dereference(ioc->ioc_data);
2999   - if (cic && cic->key == cfqd)
  2984 + if (cic && cic->q == q)
3000 2985 goto out;
3001 2986  
3002 2987 cic = radix_tree_lookup(&ioc->radix_root, cfqd->queue->id);
3003   - if (cic && cic->key == cfqd)
  2988 + if (cic && cic->q == q)
3004 2989 rcu_assign_pointer(ioc->ioc_data, cic); /* allowed to race */
3005 2990 else
3006 2991 cic = NULL;
... ... @@ -3040,7 +3025,6 @@
3040 3025 goto out;
3041 3026  
3042 3027 cic->ioc = ioc;
3043   - cic->key = cfqd;
3044 3028 cic->q = cfqd->queue;
3045 3029  
3046 3030 /* lock both q and ioc and try to link @cic */
include/linux/iocontext.h
... ... @@ -20,7 +20,6 @@
20 20 };
21 21  
22 22 struct cfq_io_context {
23   - void *key;
24 23 struct request_queue *q;
25 24  
26 25 struct cfq_queue *cfqq[2];