REQ_F_MULTISHOT|REQ_F_APOLL_MULTISHOT is repeated twice in io_wq_submit_work(). Introduce a constant variable multishot_flags for it to reduce the repetition. Signed-off-by: Caleb Sander Mateos --- io_uring/io_uring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 5db57bf675f0..28ef95851510 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1617,10 +1617,11 @@ void io_wq_free_work(struct io_wq_work *work) void io_wq_submit_work(struct io_wq_work *work) { struct io_kiocb *req = container_of(work, struct io_kiocb, work); const struct io_issue_def *def = &io_issue_defs[req->opcode]; unsigned int issue_flags = IO_URING_F_UNLOCKED | IO_URING_F_IOWQ; + io_req_flags_t multishot_flags = REQ_F_MULTISHOT|REQ_F_APOLL_MULTISHOT; bool needs_poll = false; int ret = 0, err = -ECANCELED; /* one will be dropped by io_wq_put_work() after returning to io-wq */ if (!(req->flags & REQ_F_REFCOUNT)) @@ -1647,22 +1648,22 @@ void io_wq_submit_work(struct io_wq_work *work) * right context, however this is not the case of auxiliary CQEs, * which is the main mean of operation for multishot requests. * Don't allow any multishot execution from io-wq. It's more restrictive * than necessary and also cleaner. */ - if (req->flags & (REQ_F_MULTISHOT|REQ_F_APOLL_MULTISHOT)) { + if (req->flags & multishot_flags) { err = -EBADFD; if (!io_file_can_poll(req)) goto fail; if (req->file->f_flags & O_NONBLOCK || req->file->f_mode & FMODE_NOWAIT) { err = -ECANCELED; if (io_arm_poll_handler(req, issue_flags) != IO_APOLL_OK) goto fail; return; } else { - req->flags &= ~(REQ_F_APOLL_MULTISHOT|REQ_F_MULTISHOT); + req->flags &= ~multishot_flags; } } if (req->flags & REQ_F_FORCE_ASYNC) { bool opcode_poll = def->pollin || def->pollout; -- 2.56.1