提交 658d0a40 编写于 作者: P Pavel Begunkov 提交者: Jens Axboe

io_uring: check if opcode needs poll first on arming

->pollout or ->pollin are set only for opcodes that need a file, so if
io_arm_poll_handler() tests them first we can be sure that the request
has file set and the ->file check can be removed.
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/9adfe4f543d984875e516fce6da35348aab48668.1634987320.git.asml.silence@gmail.comReviewed-by: NHao Xu <haoxu@linux.alibaba.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 d01905db
......@@ -5584,12 +5584,10 @@ static int io_arm_poll_handler(struct io_kiocb *req)
struct io_poll_table ipt;
__poll_t ret, mask = EPOLLONESHOT | POLLERR | POLLPRI;
if (!req->file || !file_can_poll(req->file))
return IO_APOLL_ABORTED;
if (req->flags & REQ_F_POLLED)
return IO_APOLL_ABORTED;
if (!def->pollin && !def->pollout)
return IO_APOLL_ABORTED;
if (!file_can_poll(req->file) || (req->flags & REQ_F_POLLED))
return IO_APOLL_ABORTED;
if (def->pollin) {
mask |= POLLIN | POLLRDNORM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册