mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
io_uring: simplify __io_uring_add_tctx_node
Remove submitter parameter from __io_uring_add_tctx_node.
It was only called from one place, and we can do that logic in that one
place.
Signed-off-by: Dylan Yudaken <dylany@fb.com>
Fixes: 97bbdc06a4
("io_uring: add IORING_SETUP_SINGLE_ISSUER")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
9d84bb40bc
commit
97c96e9fa3
@ -3355,7 +3355,7 @@ static int io_uring_install_fd(struct io_ring_ctx *ctx, struct file *file)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
ret = __io_uring_add_tctx_node(ctx, false);
|
ret = __io_uring_add_tctx_node(ctx);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
put_unused_fd(fd);
|
put_unused_fd(fd);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -105,18 +105,12 @@ static int io_register_submitter(struct io_ring_ctx *ctx)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __io_uring_add_tctx_node(struct io_ring_ctx *ctx, bool submitter)
|
int __io_uring_add_tctx_node(struct io_ring_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct io_uring_task *tctx = current->io_uring;
|
struct io_uring_task *tctx = current->io_uring;
|
||||||
struct io_tctx_node *node;
|
struct io_tctx_node *node;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((ctx->flags & IORING_SETUP_SINGLE_ISSUER) && submitter) {
|
|
||||||
ret = io_register_submitter(ctx);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unlikely(!tctx)) {
|
if (unlikely(!tctx)) {
|
||||||
ret = io_uring_alloc_task_context(current, ctx);
|
ret = io_uring_alloc_task_context(current, ctx);
|
||||||
if (unlikely(ret))
|
if (unlikely(ret))
|
||||||
@ -150,8 +144,24 @@ int __io_uring_add_tctx_node(struct io_ring_ctx *ctx, bool submitter)
|
|||||||
list_add(&node->ctx_node, &ctx->tctx_list);
|
list_add(&node->ctx_node, &ctx->tctx_list);
|
||||||
mutex_unlock(&ctx->uring_lock);
|
mutex_unlock(&ctx->uring_lock);
|
||||||
}
|
}
|
||||||
if (submitter)
|
return 0;
|
||||||
tctx->last = ctx;
|
}
|
||||||
|
|
||||||
|
int __io_uring_add_tctx_node_from_submit(struct io_ring_ctx *ctx)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (ctx->flags & IORING_SETUP_SINGLE_ISSUER) {
|
||||||
|
ret = io_register_submitter(ctx);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = __io_uring_add_tctx_node(ctx);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
current->io_uring->last = ctx;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +269,7 @@ int io_ringfd_register(struct io_ring_ctx *ctx, void __user *__arg,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
mutex_unlock(&ctx->uring_lock);
|
mutex_unlock(&ctx->uring_lock);
|
||||||
ret = __io_uring_add_tctx_node(ctx, false);
|
ret = __io_uring_add_tctx_node(ctx);
|
||||||
mutex_lock(&ctx->uring_lock);
|
mutex_lock(&ctx->uring_lock);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -9,7 +9,8 @@ struct io_tctx_node {
|
|||||||
int io_uring_alloc_task_context(struct task_struct *task,
|
int io_uring_alloc_task_context(struct task_struct *task,
|
||||||
struct io_ring_ctx *ctx);
|
struct io_ring_ctx *ctx);
|
||||||
void io_uring_del_tctx_node(unsigned long index);
|
void io_uring_del_tctx_node(unsigned long index);
|
||||||
int __io_uring_add_tctx_node(struct io_ring_ctx *ctx, bool submitter);
|
int __io_uring_add_tctx_node(struct io_ring_ctx *ctx);
|
||||||
|
int __io_uring_add_tctx_node_from_submit(struct io_ring_ctx *ctx);
|
||||||
void io_uring_clean_tctx(struct io_uring_task *tctx);
|
void io_uring_clean_tctx(struct io_uring_task *tctx);
|
||||||
|
|
||||||
void io_uring_unreg_ringfd(void);
|
void io_uring_unreg_ringfd(void);
|
||||||
@ -27,5 +28,6 @@ static inline int io_uring_add_tctx_node(struct io_ring_ctx *ctx)
|
|||||||
|
|
||||||
if (likely(tctx && tctx->last == ctx))
|
if (likely(tctx && tctx->last == ctx))
|
||||||
return 0;
|
return 0;
|
||||||
return __io_uring_add_tctx_node(ctx, true);
|
|
||||||
|
return __io_uring_add_tctx_node_from_submit(ctx);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user