Commit fa456228 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: remove index from sqe_submit

submit->index is used only for inbound check in submission path (i.e.
head < ctx->sq_entries). However, it always will be true, as
1. it's already validated by io_get_sqring()
2. ctx->sq_entries can't be changedd in between, because of held
ctx->uring_lock and ctx->refs.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c826bd7a
...@@ -271,7 +271,6 @@ struct io_ring_ctx { ...@@ -271,7 +271,6 @@ struct io_ring_ctx {
struct sqe_submit { struct sqe_submit {
const struct io_uring_sqe *sqe; const struct io_uring_sqe *sqe;
unsigned short index;
u32 sequence; u32 sequence;
bool has_user; bool has_user;
bool in_async; bool in_async;
...@@ -2168,9 +2167,6 @@ static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, ...@@ -2168,9 +2167,6 @@ static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
req->user_data = READ_ONCE(s->sqe->user_data); req->user_data = READ_ONCE(s->sqe->user_data);
if (unlikely(s->index >= ctx->sq_entries))
return -EINVAL;
opcode = READ_ONCE(s->sqe->opcode); opcode = READ_ONCE(s->sqe->opcode);
switch (opcode) { switch (opcode) {
case IORING_OP_NOP: case IORING_OP_NOP:
...@@ -2716,7 +2712,6 @@ static bool io_get_sqring(struct io_ring_ctx *ctx, struct sqe_submit *s) ...@@ -2716,7 +2712,6 @@ static bool io_get_sqring(struct io_ring_ctx *ctx, struct sqe_submit *s)
head = READ_ONCE(sq_array[head & ctx->sq_mask]); head = READ_ONCE(sq_array[head & ctx->sq_mask]);
if (head < ctx->sq_entries) { if (head < ctx->sq_entries) {
s->index = head;
s->sqe = &ctx->sq_sqes[head]; s->sqe = &ctx->sq_sqes[head];
s->sequence = ctx->cached_sq_head; s->sequence = ctx->cached_sq_head;
ctx->cached_sq_head++; ctx->cached_sq_head++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment