diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-01-20 09:10:30 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-01-29 15:17:41 -0700 |
commit | f499254474a83bf60191c86de82c1fec1d8eb9f9 (patch) | |
tree | fc5ddb7d16dd3a54202257a4c83e75b3c35753fc /io_uring/io_uring.c | |
parent | c1755c25a7190494b45861284b4a30bd9cd813ff (diff) | |
download | linux-f499254474a83bf60191c86de82c1fec1d8eb9f9.tar.gz linux-f499254474a83bf60191c86de82c1fec1d8eb9f9.tar.bz2 linux-f499254474a83bf60191c86de82c1fec1d8eb9f9.zip |
io_uring: pass in io_issue_def to io_assign_file()
This generates better code for me, avoiding an extra load on arm64, and
both call sites already have this variable available for easy passing.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.c')
-rw-r--r-- | io_uring/io_uring.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 407834255a59..4958725e0b97 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1855,9 +1855,10 @@ static void io_clean_op(struct io_kiocb *req) req->flags &= ~IO_REQ_CLEAN_FLAGS; } -static bool io_assign_file(struct io_kiocb *req, unsigned int issue_flags) +static bool io_assign_file(struct io_kiocb *req, const struct io_issue_def *def, + unsigned int issue_flags) { - if (req->file || !io_issue_defs[req->opcode].needs_file) + if (req->file || !def->needs_file) return true; if (req->flags & REQ_F_FIXED_FILE) @@ -1874,7 +1875,7 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags) const struct cred *creds = NULL; int ret; - if (unlikely(!io_assign_file(req, issue_flags))) + if (unlikely(!io_assign_file(req, def, issue_flags))) return -EBADF; if (unlikely((req->flags & REQ_F_CREDS) && req->creds != current_cred())) @@ -1943,7 +1944,7 @@ fail: io_req_task_queue_fail(req, err); return; } - if (!io_assign_file(req, issue_flags)) { + if (!io_assign_file(req, def, issue_flags)) { err = -EBADF; work->flags |= IO_WQ_WORK_CANCEL; goto fail; |