io_uring: add io_commit_cqring_flush()
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 20 Jun 2022 00:25:57 +0000 (01:25 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Jul 2022 00:39:15 +0000 (18:39 -0600)
Since __io_commit_cqring_flush users moved to different files, introduce
io_commit_cqring_flush() helper and encapsulate all flags testing details
inside.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/0da03887435dd9869ffe46dcd3962bf104afcca3.1655684496.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c
io_uring/io_uring.h
io_uring/rw.c

index 0db73d01455d1085894107f19ea7eae52c6853ed..3e65e04915a78250acec4beff17142d46c256a0e 100644 (file)
@@ -529,10 +529,7 @@ void __io_commit_cqring_flush(struct io_ring_ctx *ctx)
 
 static inline void io_cqring_ev_posted(struct io_ring_ctx *ctx)
 {
-       if (unlikely(ctx->off_timeout_used || ctx->drain_active ||
-                    ctx->has_evfd))
-               __io_commit_cqring_flush(ctx);
-
+       io_commit_cqring_flush(ctx);
        io_cqring_wake(ctx);
 }
 
index 738fb96575ab7c671a07240bb075d169ab38ca94..afca7ff8956c3235c07c1878e0f95dc5f0a66cb8 100644 (file)
@@ -229,4 +229,10 @@ static inline void io_req_add_compl_list(struct io_kiocb *req)
        wq_list_add_tail(&req->comp_list, &state->compl_reqs);
 }
 
+static inline void io_commit_cqring_flush(struct io_ring_ctx *ctx)
+{
+       if (unlikely(ctx->off_timeout_used || ctx->drain_active || ctx->has_evfd))
+               __io_commit_cqring_flush(ctx);
+}
+
 #endif
index f8b42f2265df987dc8c6aa5618066c49b8fd758f..0028e95e6633af0ad2e40caf9a29c7258206d6c7 100644 (file)
@@ -1016,10 +1016,7 @@ copy_iov:
 
 static void io_cqring_ev_posted_iopoll(struct io_ring_ctx *ctx)
 {
-       if (unlikely(ctx->off_timeout_used || ctx->drain_active ||
-                    ctx->has_evfd))
-               __io_commit_cqring_flush(ctx);
-
+       io_commit_cqring_flush(ctx);
        if (ctx->flags & IORING_SETUP_SQPOLL)
                io_cqring_wake(ctx);
 }