diff options
author | Jens Axboe <axboe@kernel.dk> | 2021-04-16 02:44:34 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-04-16 18:45:47 +0300 |
commit | 4e3d9ff905cd3e6fc80a1f54b89c3aca67bc72be (patch) | |
tree | 90e614cdcade3f4439e9e34a71821c954178deba /fs/io_uring.c | |
parent | ea6a693d862d4f0edd748a1fa3fc6faf2c39afb2 (diff) | |
download | linux-4e3d9ff905cd3e6fc80a1f54b89c3aca67bc72be.tar.xz |
io_uring: put flag checking for needing req cleanup in one spot
We have this in two spots right now, which is a bit fragile. In
preparation for moving REQ_F_POLLED cleanup into the same spot, move
the check into a separate helper so we only have it once.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 4803e31e9301..8e6dcb69f3e9 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1598,10 +1598,15 @@ static void io_req_complete_post(struct io_kiocb *req, long res, } } +static inline bool io_req_needs_clean(struct io_kiocb *req) +{ + return req->flags & (REQ_F_BUFFER_SELECTED | REQ_F_NEED_CLEANUP); +} + static void io_req_complete_state(struct io_kiocb *req, long res, unsigned int cflags) { - if (req->flags & (REQ_F_NEED_CLEANUP | REQ_F_BUFFER_SELECTED)) + if (io_req_needs_clean(req)) io_clean_op(req); req->result = res; req->compl.cflags = cflags; @@ -1713,10 +1718,8 @@ static void io_dismantle_req(struct io_kiocb *req) if (!(flags & REQ_F_FIXED_FILE)) io_put_file(req->file); - if (flags & (REQ_F_NEED_CLEANUP | REQ_F_BUFFER_SELECTED | - REQ_F_INFLIGHT)) { + if (io_req_needs_clean(req) || (req->flags & REQ_F_INFLIGHT)) { io_clean_op(req); - if (req->flags & REQ_F_INFLIGHT) { struct io_uring_task *tctx = req->task->io_uring; |