diff options
author | Jens Axboe <axboe@fb.com> | 2016-12-15 00:23:43 +0300 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-01-17 20:03:42 +0300 |
commit | c23ecb426084a98418ee29124c139e37c274ad04 (patch) | |
tree | cc5a01c2a4af28ce0fbd539bb6194812f1cb1510 /block/blk.h | |
parent | c51ca6cf545bc51ad38bd50816bde37c647d608d (diff) | |
download | linux-c23ecb426084a98418ee29124c139e37c274ad04.tar.xz |
block: move rq_ioc() to blk.h
We want to use it outside of blk-core.c.
Signed-off-by: Jens Axboe <axboe@fb.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Diffstat (limited to 'block/blk.h')
-rw-r--r-- | block/blk.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/block/blk.h b/block/blk.h index f46c0ac8ae3d..9a716b5925a4 100644 --- a/block/blk.h +++ b/block/blk.h @@ -264,6 +264,22 @@ void ioc_clear_queue(struct request_queue *q); int create_task_io_context(struct task_struct *task, gfp_t gfp_mask, int node); /** + * rq_ioc - determine io_context for request allocation + * @bio: request being allocated is for this bio (can be %NULL) + * + * Determine io_context to use for request allocation for @bio. May return + * %NULL if %current->io_context doesn't exist. + */ +static inline struct io_context *rq_ioc(struct bio *bio) +{ +#ifdef CONFIG_BLK_CGROUP + if (bio && bio->bi_ioc) + return bio->bi_ioc; +#endif + return current->io_context; +} + +/** * create_io_context - try to create task->io_context * @gfp_mask: allocation mask * @node: allocation node |