From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk, vgoyal@redhat.com
Cc: ctalbott@google.com, rni@google.com,
linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 13/13] block, cfq: kill cic->key
Date: Tue, 25 Oct 2011 18:48:39 -0700 [thread overview]
Message-ID: <1319593719-19132-14-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1319593719-19132-1-git-send-email-tj@kernel.org>
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>
Cc: Jens Axboe <axboe@kernel.dk>
---
block/cfq-iosched.c | 26 +++++---------------------
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 ae7791a..3b07ce1 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,
cic->cfqq[is_sync] = cfqq;
}
-#define CIC_DEAD_KEY 1ul
-#define CIC_DEAD_INDEX_SHIFT 1
-
-static inline void *cfqd_dead_key(struct cfq_data *cfqd)
-{
- return (void *)(cfqd->queue->id << CIC_DEAD_INDEX_SHIFT | CIC_DEAD_KEY);
-}
-
static inline struct cfq_data *cic_to_cfqd(struct cfq_io_context *cic)
{
- struct cfq_data *cfqd = cic->key;
-
- if (unlikely((unsigned long) cfqd & CIC_DEAD_KEY))
- return NULL;
-
- return cfqd;
+ return cic->q->elevator->elevator_data;
}
/*
@@ -2679,10 +2666,8 @@ static void cfq_cic_free(struct cfq_io_context *cic)
static void cfq_release_cic(struct cfq_io_context *cic)
{
struct io_context *ioc = cic->ioc;
- unsigned long dead_key = (unsigned long) cic->key;
- BUG_ON(!(dead_key & CIC_DEAD_KEY));
- radix_tree_delete(&ioc->radix_root, dead_key >> CIC_DEAD_INDEX_SHIFT);
+ radix_tree_delete(&ioc->radix_root, cic->q->id);
hlist_del(&cic->cic_list);
cfq_cic_free(cic);
}
@@ -2726,7 +2711,6 @@ static void cfq_exit_cic(struct cfq_io_context *cic)
struct io_context *ioc = cic->ioc;
list_del_init(&cic->queue_list);
- cic->key = cfqd_dead_key(cfqd);
/*
* 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,
static struct cfq_io_context *
cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc)
{
+ struct request_queue *q = cfqd->queue;
struct cfq_io_context *cic;
lockdep_assert_held(cfqd->queue->queue_lock);
@@ -2996,11 +2981,11 @@ cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc)
*/
rcu_read_lock();
cic = rcu_dereference(ioc->ioc_data);
- if (cic && cic->key == cfqd)
+ if (cic && cic->q == q)
goto out;
cic = radix_tree_lookup(&ioc->radix_root, cfqd->queue->id);
- if (cic && cic->key == cfqd)
+ if (cic && cic->q == q)
rcu_assign_pointer(ioc->ioc_data, cic); /* allowed to race */
else
cic = NULL;
@@ -3040,7 +3025,6 @@ static int cfq_create_cic(struct cfq_data *cfqd, gfp_t gfp_mask)
goto out;
cic->ioc = ioc;
- cic->key = cfqd;
cic->q = cfqd->queue;
/* lock both q and ioc and try to link @cic */
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 01e8631..b2b75a5 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -20,7 +20,6 @@ enum {
};
struct cfq_io_context {
- void *key;
struct request_queue *q;
struct cfq_queue *cfqq[2];
--
1.7.3.1
next prev parent reply other threads:[~2011-10-26 1:49 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-26 1:48 [PATCHSET block:for-3.2/core] rescue cfq from RCU death sprial :) Tejun Heo
2011-10-26 1:48 ` [PATCH 01/13] ida: make ida_simple_get/put() IRQ safe Tejun Heo
2011-10-26 4:42 ` Rusty Russell
2011-10-26 20:28 ` Tejun Heo
2011-10-26 1:48 ` [PATCH 02/13] block, cfq: move cfqd->cic_index to q->id Tejun Heo
2011-10-26 1:48 ` [PATCH 03/13] block: misc ioc cleanups Tejun Heo
2011-10-26 1:48 ` [PATCH 04/13] block: make ioc get/put interface more conventional and fix race on alloction Tejun Heo
2011-10-26 16:01 ` Vivek Goyal
2011-10-26 19:29 ` Tejun Heo
2011-10-26 21:30 ` [PATCH UPDATED " Tejun Heo
2011-10-26 1:48 ` [PATCH 05/13] block: misc updates to blk_get_queue() Tejun Heo
2011-10-26 1:48 ` [PATCH 06/13] block, cfq: misc updates to cfq_io_context Tejun Heo
2011-10-27 15:39 ` Vivek Goyal
2011-10-27 16:24 ` Tejun Heo
2011-10-26 1:48 ` [PATCH 07/13] block, cfq: move ioc ioprio/cgroup changed handling to cic Tejun Heo
2011-10-26 1:48 ` [PATCH 08/13] block, cfq: fix race condition in cic creation path and tighten locking Tejun Heo
2011-10-26 1:48 ` [PATCH 09/13] block, cfq: fix cic lookup locking Tejun Heo
2011-10-26 1:48 ` [PATCH 10/13] block, cfq: unlink cfq_io_context's immediately Tejun Heo
2011-10-26 19:48 ` Vivek Goyal
2011-10-26 19:55 ` Tejun Heo
2011-10-26 20:38 ` Vivek Goyal
2011-10-26 20:54 ` Tejun Heo
2011-10-26 21:31 ` [PATCH UPDATED " Tejun Heo
2011-10-27 14:31 ` Vivek Goyal
2011-10-27 16:17 ` Tejun Heo
2011-10-27 17:05 ` Vivek Goyal
2011-10-27 17:11 ` Tejun Heo
2011-10-26 1:48 ` [PATCH 11/13] block, cfq: remove delayed unlink Tejun Heo
2011-10-26 1:48 ` [PATCH 12/13] block, cfq: kill ioc_gone Tejun Heo
2011-10-26 1:48 ` Tejun Heo [this message]
2011-10-26 21:36 ` [PATCHSET block:for-3.2/core] rescue cfq from RCU death sprial :) Tejun Heo
2011-10-27 15:32 ` Vivek Goyal
2011-10-27 16:10 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319593719-19132-14-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=ctalbott@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rni@google.com \
--cc=vgoyal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.