提交 18b74c4d 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

block: simplify ioc_create_icq

Remove the ioc and gfp_mask argument, which are hard coded by the caller.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211126115817.2087431-14-hch@lst.deSigned-off-by: NJens Axboe <axboe@kernel.dk>
上级 d538ea4c
...@@ -389,9 +389,7 @@ EXPORT_SYMBOL(ioc_lookup_icq); ...@@ -389,9 +389,7 @@ EXPORT_SYMBOL(ioc_lookup_icq);
/** /**
* ioc_create_icq - create and link io_cq * ioc_create_icq - create and link io_cq
* @ioc: io_context of interest
* @q: request_queue of interest * @q: request_queue of interest
* @gfp_mask: allocation mask
* *
* Make sure io_cq linking @ioc and @q exists. If icq doesn't exist, they * Make sure io_cq linking @ioc and @q exists. If icq doesn't exist, they
* will be created using @gfp_mask. * will be created using @gfp_mask.
...@@ -399,19 +397,19 @@ EXPORT_SYMBOL(ioc_lookup_icq); ...@@ -399,19 +397,19 @@ EXPORT_SYMBOL(ioc_lookup_icq);
* The caller is responsible for ensuring @ioc won't go away and @q is * The caller is responsible for ensuring @ioc won't go away and @q is
* alive and will stay alive until this function returns. * alive and will stay alive until this function returns.
*/ */
static struct io_cq *ioc_create_icq(struct io_context *ioc, static struct io_cq *ioc_create_icq(struct request_queue *q)
struct request_queue *q, gfp_t gfp_mask)
{ {
struct io_context *ioc = current->io_context;
struct elevator_type *et = q->elevator->type; struct elevator_type *et = q->elevator->type;
struct io_cq *icq; struct io_cq *icq;
/* allocate stuff */ /* allocate stuff */
icq = kmem_cache_alloc_node(et->icq_cache, gfp_mask | __GFP_ZERO, icq = kmem_cache_alloc_node(et->icq_cache, GFP_ATOMIC | __GFP_ZERO,
q->node); q->node);
if (!icq) if (!icq)
return NULL; return NULL;
if (radix_tree_maybe_preload(gfp_mask) < 0) { if (radix_tree_maybe_preload(GFP_ATOMIC) < 0) {
kmem_cache_free(et->icq_cache, icq); kmem_cache_free(et->icq_cache, icq);
return NULL; return NULL;
} }
...@@ -461,7 +459,7 @@ struct io_cq *ioc_find_get_icq(struct request_queue *q) ...@@ -461,7 +459,7 @@ struct io_cq *ioc_find_get_icq(struct request_queue *q)
} }
if (!icq) { if (!icq) {
icq = ioc_create_icq(ioc, q, GFP_ATOMIC); icq = ioc_create_icq(q);
if (!icq) { if (!icq) {
put_io_context(ioc); put_io_context(ioc);
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册