Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 97bbdc06a444 ("io_uring: add IORING_SETUP_SINGLE_ISSUER")
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Dylan Yudaken and committed by
Jens Axboe
97c96e9f 9d84bb40

+25 -13
+1 -1
io_uring/io_uring.c
··· 3355 3355 if (fd < 0) 3356 3356 return fd; 3357 3357 3358 - ret = __io_uring_add_tctx_node(ctx, false); 3358 + ret = __io_uring_add_tctx_node(ctx); 3359 3359 if (ret) { 3360 3360 put_unused_fd(fd); 3361 3361 return ret;
+20 -10
io_uring/tctx.c
··· 105 105 return ret; 106 106 } 107 107 108 - int __io_uring_add_tctx_node(struct io_ring_ctx *ctx, bool submitter) 108 + int __io_uring_add_tctx_node(struct io_ring_ctx *ctx) 109 109 { 110 110 struct io_uring_task *tctx = current->io_uring; 111 111 struct io_tctx_node *node; 112 112 int ret; 113 - 114 - if ((ctx->flags & IORING_SETUP_SINGLE_ISSUER) && submitter) { 115 - ret = io_register_submitter(ctx); 116 - if (ret) 117 - return ret; 118 - } 119 113 120 114 if (unlikely(!tctx)) { 121 115 ret = io_uring_alloc_task_context(current, ctx); ··· 144 150 list_add(&node->ctx_node, &ctx->tctx_list); 145 151 mutex_unlock(&ctx->uring_lock); 146 152 } 147 - if (submitter) 148 - tctx->last = ctx; 153 + return 0; 154 + } 155 + 156 + int __io_uring_add_tctx_node_from_submit(struct io_ring_ctx *ctx) 157 + { 158 + int ret; 159 + 160 + if (ctx->flags & IORING_SETUP_SINGLE_ISSUER) { 161 + ret = io_register_submitter(ctx); 162 + if (ret) 163 + return ret; 164 + } 165 + 166 + ret = __io_uring_add_tctx_node(ctx); 167 + if (ret) 168 + return ret; 169 + 170 + current->io_uring->last = ctx; 149 171 return 0; 150 172 } 151 173 ··· 269 259 return -EINVAL; 270 260 271 261 mutex_unlock(&ctx->uring_lock); 272 - ret = __io_uring_add_tctx_node(ctx, false); 262 + ret = __io_uring_add_tctx_node(ctx); 273 263 mutex_lock(&ctx->uring_lock); 274 264 if (ret) 275 265 return ret;
+4 -2
io_uring/tctx.h
··· 9 9 int io_uring_alloc_task_context(struct task_struct *task, 10 10 struct io_ring_ctx *ctx); 11 11 void io_uring_del_tctx_node(unsigned long index); 12 - int __io_uring_add_tctx_node(struct io_ring_ctx *ctx, bool submitter); 12 + int __io_uring_add_tctx_node(struct io_ring_ctx *ctx); 13 + int __io_uring_add_tctx_node_from_submit(struct io_ring_ctx *ctx); 13 14 void io_uring_clean_tctx(struct io_uring_task *tctx); 14 15 15 16 void io_uring_unreg_ringfd(void); ··· 28 27 29 28 if (likely(tctx && tctx->last == ctx)) 30 29 return 0; 31 - return __io_uring_add_tctx_node(ctx, true); 30 + 31 + return __io_uring_add_tctx_node_from_submit(ctx); 32 32 }