From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 06/12] io_uring: use a separate struct for timeout_remove
Date: Sat, 10 Oct 2020 18:34:10 +0100 [thread overview]
Message-ID: <eef0f94bc079ff4135e0903286dc7d897b662867.1602350806.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
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 <[email protected]>
---
fs/io_uring.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 250eefbe13cb..09b8f2c9ae7e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -434,13 +434,16 @@ struct io_cancel {
struct io_timeout {
struct file *file;
- u64 addr;
- int flags;
u32 off;
u32 target_seq;
struct list_head list;
};
+struct io_timeout_rem {
+ struct file *file;
+ u64 addr;
+};
+
struct io_rw {
/* NOTE: kiocb has the file as the first member, so don't do it here */
struct kiocb kiocb;
@@ -644,6 +647,7 @@ struct io_kiocb {
struct io_sync sync;
struct io_cancel cancel;
struct io_timeout timeout;
+ struct io_timeout_rem timeout_rem;
struct io_connect connect;
struct io_sr_msg sr_msg;
struct io_open open;
@@ -5360,14 +5364,10 @@ static int io_timeout_remove_prep(struct io_kiocb *req,
return -EINVAL;
if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
return -EINVAL;
- if (sqe->ioprio || sqe->buf_index || sqe->len)
- return -EINVAL;
-
- req->timeout.addr = READ_ONCE(sqe->addr);
- req->timeout.flags = READ_ONCE(sqe->timeout_flags);
- if (req->timeout.flags)
+ if (sqe->ioprio || sqe->buf_index || sqe->len || sqe->timeout_flags)
return -EINVAL;
+ req->timeout_rem.addr = READ_ONCE(sqe->addr);
return 0;
}
@@ -5380,7 +5380,7 @@ static int io_timeout_remove(struct io_kiocb *req)
int ret;
spin_lock_irq(&ctx->completion_lock);
- ret = io_timeout_cancel(ctx, req->timeout.addr);
+ ret = io_timeout_cancel(ctx, req->timeout_rem.addr);
io_cqring_fill_event(req, ret);
io_commit_cqring(ctx);
--
2.24.0
next prev parent reply other threads:[~2020-10-10 22:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-10 17:34 [PATCH 00/12] bundled cleanups and improvements Pavel Begunkov
2020-10-10 17:34 ` [PATCH 01/12] io_uring: don't io_prep_async_work() linked reqs Pavel Begunkov
2020-10-10 18:45 ` Pavel Begunkov
2020-10-10 18:49 ` Jens Axboe
2020-10-10 18:55 ` Pavel Begunkov
2020-10-10 17:34 ` [PATCH 02/12] io_uring: clean up ->files grabbing Pavel Begunkov
2020-10-10 17:34 ` [PATCH 03/12] io_uring: kill extra check in fixed io_file_get() Pavel Begunkov
2020-10-10 17:34 ` [PATCH 04/12] io_uring: simplify io_file_get() Pavel Begunkov
2020-10-10 17:34 ` [PATCH 05/12] io_uring: improve submit_state.ios_left accounting Pavel Begunkov
2020-10-10 17:34 ` Pavel Begunkov [this message]
2020-10-10 17:34 ` [PATCH 07/12] io_uring: remove timeout.list after hrtimer cancel Pavel Begunkov
2020-10-10 17:34 ` [PATCH 08/12] io_uring: clean leftovers after splitting issue Pavel Begunkov
2020-10-10 17:34 ` [PATCH 09/12] io_uring: don't delay io_init_req() error check Pavel Begunkov
2020-10-10 17:34 ` [PATCH 10/12] io_uring: clean file_data access in files_register Pavel Begunkov
2020-10-10 17:34 ` [PATCH 11/12] io_uring: refactor *files_register()'s error paths Pavel Begunkov
2020-10-10 17:34 ` [PATCH 12/12] io_uring: keep a pointer ref_node in file_data Pavel Begunkov
2020-10-10 18:48 ` [PATCH 00/12] bundled cleanups and improvements Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eef0f94bc079ff4135e0903286dc7d897b662867.1602350806.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox