提交 351fd535 编写于 作者: P Pavel Begunkov 提交者: Jens Axboe

io_uring: don't pass def into io_req_work_grab_env

Remove struct io_op_def *def parameter from io_req_work_grab_env(),
it's trivially deducible from req->opcode and fast. The API is
cleaner this way, and also helps the complier to understand
that it's a real constant and could be register-cached.
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 ecfc5177
......@@ -1101,9 +1101,10 @@ static void __io_commit_cqring(struct io_ring_ctx *ctx)
}
}
static inline void io_req_work_grab_env(struct io_kiocb *req,
const struct io_op_def *def)
static inline void io_req_work_grab_env(struct io_kiocb *req)
{
const struct io_op_def *def = &io_op_defs[req->opcode];
if (!req->work.mm && def->needs_mm) {
mmgrab(current->mm);
req->work.mm = current->mm;
......@@ -1161,7 +1162,7 @@ static inline void io_prep_async_work(struct io_kiocb *req,
}
io_req_init_async(req);
io_req_work_grab_env(req, def);
io_req_work_grab_env(req);
*link = io_prep_linked_timeout(req);
}
......@@ -5255,7 +5256,7 @@ static int io_req_defer_prep(struct io_kiocb *req,
if (for_async || (req->flags & REQ_F_WORK_INITIALIZED)) {
io_req_init_async(req);
io_req_work_grab_env(req, &io_op_defs[req->opcode]);
io_req_work_grab_env(req);
}
switch (req->opcode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册