Commit 68fb8979 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: inline io_clean_op()'s fast path

Inline io_clean_op(), leaving __io_clean_op() but renaming it. This will
be used in following patches.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 2593553a
...@@ -1032,7 +1032,7 @@ static void io_queue_linked_timeout(struct io_kiocb *req); ...@@ -1032,7 +1032,7 @@ static void io_queue_linked_timeout(struct io_kiocb *req);
static int __io_sqe_files_update(struct io_ring_ctx *ctx, static int __io_sqe_files_update(struct io_ring_ctx *ctx,
struct io_uring_rsrc_update *ip, struct io_uring_rsrc_update *ip,
unsigned nr_args); unsigned nr_args);
static void __io_clean_op(struct io_kiocb *req); static void io_clean_op(struct io_kiocb *req);
static struct file *io_file_get(struct io_submit_state *state, static struct file *io_file_get(struct io_submit_state *state,
struct io_kiocb *req, int fd, bool fixed); struct io_kiocb *req, int fd, bool fixed);
static void __io_queue_sqe(struct io_kiocb *req); static void __io_queue_sqe(struct io_kiocb *req);
...@@ -1063,12 +1063,6 @@ EXPORT_SYMBOL(io_uring_get_socket); ...@@ -1063,12 +1063,6 @@ EXPORT_SYMBOL(io_uring_get_socket);
#define io_for_each_link(pos, head) \ #define io_for_each_link(pos, head) \
for (pos = (head); pos; pos = pos->link) for (pos = (head); pos; pos = pos->link)
static inline void io_clean_op(struct io_kiocb *req)
{
if (req->flags & (REQ_F_NEED_CLEANUP | REQ_F_BUFFER_SELECTED))
__io_clean_op(req);
}
static inline void io_set_resource_node(struct io_kiocb *req) static inline void io_set_resource_node(struct io_kiocb *req)
{ {
struct io_ring_ctx *ctx = req->ctx; struct io_ring_ctx *ctx = req->ctx;
...@@ -1544,7 +1538,9 @@ static void __io_cqring_fill_event(struct io_kiocb *req, long res, ...@@ -1544,7 +1538,9 @@ static void __io_cqring_fill_event(struct io_kiocb *req, long res,
set_bit(0, &ctx->cq_check_overflow); set_bit(0, &ctx->cq_check_overflow);
ctx->rings->sq_flags |= IORING_SQ_CQ_OVERFLOW; ctx->rings->sq_flags |= IORING_SQ_CQ_OVERFLOW;
} }
io_clean_op(req); if (req->flags & (REQ_F_NEED_CLEANUP | REQ_F_BUFFER_SELECTED))
io_clean_op(req);
req->result = res; req->result = res;
req->compl.cflags = cflags; req->compl.cflags = cflags;
req_ref_get(req); req_ref_get(req);
...@@ -1600,7 +1596,8 @@ static void io_req_complete_post(struct io_kiocb *req, long res, ...@@ -1600,7 +1596,8 @@ static void io_req_complete_post(struct io_kiocb *req, long res,
static void io_req_complete_state(struct io_kiocb *req, long res, static void io_req_complete_state(struct io_kiocb *req, long res,
unsigned int cflags) unsigned int cflags)
{ {
io_clean_op(req); if (req->flags & (REQ_F_NEED_CLEANUP | REQ_F_BUFFER_SELECTED))
io_clean_op(req);
req->result = res; req->result = res;
req->compl.cflags = cflags; req->compl.cflags = cflags;
req->flags |= REQ_F_COMPLETE_INLINE; req->flags |= REQ_F_COMPLETE_INLINE;
...@@ -1708,8 +1705,8 @@ static inline void io_put_file(struct io_kiocb *req, struct file *file, ...@@ -1708,8 +1705,8 @@ static inline void io_put_file(struct io_kiocb *req, struct file *file,
static void io_dismantle_req(struct io_kiocb *req) static void io_dismantle_req(struct io_kiocb *req)
{ {
io_clean_op(req); if (req->flags & (REQ_F_NEED_CLEANUP | REQ_F_BUFFER_SELECTED))
io_clean_op(req);
if (req->async_data) if (req->async_data)
kfree(req->async_data); kfree(req->async_data);
if (req->file) if (req->file)
...@@ -5949,7 +5946,7 @@ static int io_req_defer(struct io_kiocb *req) ...@@ -5949,7 +5946,7 @@ static int io_req_defer(struct io_kiocb *req)
return -EIOCBQUEUED; return -EIOCBQUEUED;
} }
static void __io_clean_op(struct io_kiocb *req) static void io_clean_op(struct io_kiocb *req)
{ {
if (req->flags & REQ_F_BUFFER_SELECTED) { if (req->flags & REQ_F_BUFFER_SELECTED) {
switch (req->opcode) { switch (req->opcode) {
......
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