Skip to content

Commit 0bdf7a2

Browse files
isilenceaxboe
authored andcommitted
io_uring: use a separate struct for timeout_remove
Don't use struct io_timeout for both IORING_OP_TIMEOUT and IORING_OP_TIMEOUT_REMOVE, they're quite different. Split them in two, that allows to remove an unused field in struct io_timeout, and btw kill ->flags not used by either. This also easier to follow, especially for timeout remove. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 71b547c commit 0bdf7a2

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

fs/io_uring.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,16 @@ struct io_cancel {
434434

435435
struct io_timeout {
436436
struct file *file;
437-
u64 addr;
438-
int flags;
439437
u32 off;
440438
u32 target_seq;
441439
struct list_head list;
442440
};
443441

442+
struct io_timeout_rem {
443+
struct file *file;
444+
u64 addr;
445+
};
446+
444447
struct io_rw {
445448
/* NOTE: kiocb has the file as the first member, so don't do it here */
446449
struct kiocb kiocb;
@@ -644,6 +647,7 @@ struct io_kiocb {
644647
struct io_sync sync;
645648
struct io_cancel cancel;
646649
struct io_timeout timeout;
650+
struct io_timeout_rem timeout_rem;
647651
struct io_connect connect;
648652
struct io_sr_msg sr_msg;
649653
struct io_open open;
@@ -5360,14 +5364,10 @@ static int io_timeout_remove_prep(struct io_kiocb *req,
53605364
return -EINVAL;
53615365
if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
53625366
return -EINVAL;
5363-
if (sqe->ioprio || sqe->buf_index || sqe->len)
5364-
return -EINVAL;
5365-
5366-
req->timeout.addr = READ_ONCE(sqe->addr);
5367-
req->timeout.flags = READ_ONCE(sqe->timeout_flags);
5368-
if (req->timeout.flags)
5367+
if (sqe->ioprio || sqe->buf_index || sqe->len || sqe->timeout_flags)
53695368
return -EINVAL;
53705369

5370+
req->timeout_rem.addr = READ_ONCE(sqe->addr);
53715371
return 0;
53725372
}
53735373

@@ -5380,7 +5380,7 @@ static int io_timeout_remove(struct io_kiocb *req)
53805380
int ret;
53815381

53825382
spin_lock_irq(&ctx->completion_lock);
5383-
ret = io_timeout_cancel(ctx, req->timeout.addr);
5383+
ret = io_timeout_cancel(ctx, req->timeout_rem.addr);
53845384

53855385
io_cqring_fill_event(req, ret);
53865386
io_commit_cqring(ctx);

0 commit comments

Comments
 (0)