diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-01-19 13:32:34 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-01 10:02:42 -0700 |
commit | bf6182b6d46e28c3e59b9c0d6097b379cae56b94 (patch) | |
tree | a70e58c743b5d6288ea5088021b8aa0220053ab9 | |
parent | 00835dce1406e746fe5ab8c522cceb9594c78acb (diff) | |
download | linux-stable-bf6182b6d46e28c3e59b9c0d6097b379cae56b94.tar.gz linux-stable-bf6182b6d46e28c3e59b9c0d6097b379cae56b94.tar.bz2 linux-stable-bf6182b6d46e28c3e59b9c0d6097b379cae56b94.zip |
io_uring: optimise io_rw_reissue()
The hot path is IO completing on the first try. Reshuffle io_rw_reissue() so
it's checked first.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | fs/io_uring.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 98789fece715..4a8900d480c5 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2738,12 +2738,13 @@ end_req: static bool io_rw_reissue(struct io_kiocb *req, long res) { #ifdef CONFIG_BLOCK - umode_t mode = file_inode(req->file)->i_mode; + umode_t mode; int ret; - if (!S_ISBLK(mode) && !S_ISREG(mode)) + if (res != -EAGAIN && res != -EOPNOTSUPP) return false; - if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker()) + mode = file_inode(req->file)->i_mode; + if ((!S_ISBLK(mode) && !S_ISREG(mode)) || io_wq_current_is_worker()) return false; lockdep_assert_held(&req->ctx->uring_lock); |