diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-05 16:15:24 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-06 15:27:24 -0500 |
commit | 24acfc34fba0b4f62ef9d5c2616eb0faa802b606 (patch) | |
tree | 42d07b0e4ad922b24853fe542cb9ab543aa8174c /block/blk.h | |
parent | b679281a6410676a41b175c5a185150a1ae42f9d (diff) |
block: interface update for ioc/icq creation functions
Make the following interface updates to prepare for future ioc related
changes.
* create_io_context() returning ioc only works for %current because it
doesn't increment ref on the ioc. Drop @task parameter from it and
always assume %current.
* Make create_io_context_slowpath() return 0 or -errno and rename it
to create_task_io_context().
* Make ioc_create_icq() take @ioc as parameter instead of assuming
that of %current. The caller, get_request(), is updated to create
ioc explicitly and then pass it into ioc_create_icq().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk.h')
-rw-r--r-- | block/blk.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/block/blk.h b/block/blk.h index de15f920b38f..aa81afde8220 100644 --- a/block/blk.h +++ b/block/blk.h | |||
@@ -200,32 +200,30 @@ static inline int blk_do_io_stat(struct request *rq) | |||
200 | */ | 200 | */ |
201 | void get_io_context(struct io_context *ioc); | 201 | void get_io_context(struct io_context *ioc); |
202 | struct io_cq *ioc_lookup_icq(struct io_context *ioc, struct request_queue *q); | 202 | struct io_cq *ioc_lookup_icq(struct io_context *ioc, struct request_queue *q); |
203 | struct io_cq *ioc_create_icq(struct request_queue *q, gfp_t gfp_mask); | 203 | struct io_cq *ioc_create_icq(struct io_context *ioc, struct request_queue *q, |
204 | gfp_t gfp_mask); | ||
204 | void ioc_clear_queue(struct request_queue *q); | 205 | void ioc_clear_queue(struct request_queue *q); |
205 | 206 | ||
206 | void create_io_context_slowpath(struct task_struct *task, gfp_t gfp_mask, | 207 | int create_task_io_context(struct task_struct *task, gfp_t gfp_mask, int node); |
207 | int node); | ||
208 | 208 | ||
209 | /** | 209 | /** |
210 | * create_io_context - try to create task->io_context | 210 | * create_io_context - try to create task->io_context |
211 | * @task: target task | ||
212 | * @gfp_mask: allocation mask | 211 | * @gfp_mask: allocation mask |
213 | * @node: allocation node | 212 | * @node: allocation node |
214 | * | 213 | * |
215 | * If @task->io_context is %NULL, allocate a new io_context and install it. | 214 | * If %current->io_context is %NULL, allocate a new io_context and install |
216 | * Returns the current @task->io_context which may be %NULL if allocation | 215 | * it. Returns the current %current->io_context which may be %NULL if |
217 | * failed. | 216 | * allocation failed. |
218 | * | 217 | * |
219 | * Note that this function can't be called with IRQ disabled because | 218 | * Note that this function can't be called with IRQ disabled because |
220 | * task_lock which protects @task->io_context is IRQ-unsafe. | 219 | * task_lock which protects %current->io_context is IRQ-unsafe. |
221 | */ | 220 | */ |
222 | static inline struct io_context *create_io_context(struct task_struct *task, | 221 | static inline struct io_context *create_io_context(gfp_t gfp_mask, int node) |
223 | gfp_t gfp_mask, int node) | ||
224 | { | 222 | { |
225 | WARN_ON_ONCE(irqs_disabled()); | 223 | WARN_ON_ONCE(irqs_disabled()); |
226 | if (unlikely(!task->io_context)) | 224 | if (unlikely(!current->io_context)) |
227 | create_io_context_slowpath(task, gfp_mask, node); | 225 | create_task_io_context(current, gfp_mask, node); |
228 | return task->io_context; | 226 | return current->io_context; |
229 | } | 227 | } |
230 | 228 | ||
231 | /* | 229 | /* |