Commit 17bc2837 authored by Jens Axboe's avatar Jens Axboe

io_uring: have io_file_put() take an io_kiocb rather than the file

No functional changes in this patch, just a prep patch for needing the
request in io_file_put().
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9f69a259
...@@ -998,8 +998,7 @@ static void __io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) ...@@ -998,8 +998,7 @@ static void __io_req_complete_post(struct io_kiocb *req, unsigned issue_flags)
io_put_kbuf_comp(req); io_put_kbuf_comp(req);
if (unlikely(req->flags & IO_REQ_CLEAN_FLAGS)) if (unlikely(req->flags & IO_REQ_CLEAN_FLAGS))
io_clean_op(req); io_clean_op(req);
if (!(req->flags & REQ_F_FIXED_FILE)) io_put_file(req);
io_put_file(req->file);
rsrc_node = req->rsrc_node; rsrc_node = req->rsrc_node;
/* /*
...@@ -1533,8 +1532,7 @@ void io_free_batch_list(struct io_ring_ctx *ctx, struct io_wq_work_node *node) ...@@ -1533,8 +1532,7 @@ void io_free_batch_list(struct io_ring_ctx *ctx, struct io_wq_work_node *node)
if (unlikely(req->flags & IO_REQ_CLEAN_FLAGS)) if (unlikely(req->flags & IO_REQ_CLEAN_FLAGS))
io_clean_op(req); io_clean_op(req);
} }
if (!(req->flags & REQ_F_FIXED_FILE)) io_put_file(req);
io_put_file(req->file);
io_req_put_rsrc_locked(req, ctx); io_req_put_rsrc_locked(req, ctx);
......
...@@ -196,10 +196,10 @@ static inline bool req_has_async_data(struct io_kiocb *req) ...@@ -196,10 +196,10 @@ static inline bool req_has_async_data(struct io_kiocb *req)
return req->flags & REQ_F_ASYNC_DATA; return req->flags & REQ_F_ASYNC_DATA;
} }
static inline void io_put_file(struct file *file) static inline void io_put_file(struct io_kiocb *req)
{ {
if (file) if (!(req->flags & REQ_F_FIXED_FILE) && req->file)
fput(file); fput(req->file);
} }
static inline void io_ring_submit_unlock(struct io_ring_ctx *ctx, static inline void io_ring_submit_unlock(struct io_ring_ctx *ctx,
......
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