summaryrefslogtreecommitdiffstats
path: root/io_uring/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-06-17 10:48:00 +0200
committerJens Axboe <axboe@kernel.dk>2022-07-25 02:39:14 +0200
commitd245bca6375bccfd589a6a7d5007df28575bb626 (patch)
treece0fbcda110609810940ebd21bdebeb2d942513f /io_uring/io_uring.c
parentio_uring: kbuf: add comments for some tricky code (diff)
downloadlinux-d245bca6375bccfd589a6a7d5007df28575bb626.tar.xz
linux-d245bca6375bccfd589a6a7d5007df28575bb626.zip
io_uring: don't expose io_fill_cqe_aux()
Deduplicate some code and add a helper for filling an aux CQE, locking and notification. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/b7c6557c8f9dc5c4cfb01292116c682a0ff61081.1655455613.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.c')
-rw-r--r--io_uring/io_uring.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index eeda16731795..8c1b0e0ce5bb 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -676,8 +676,8 @@ bool io_cqring_event_overflow(struct io_ring_ctx *ctx, u64 user_data, s32 res,
return true;
}
-bool io_fill_cqe_aux(struct io_ring_ctx *ctx, u64 user_data, s32 res,
- u32 cflags)
+static bool io_fill_cqe_aux(struct io_ring_ctx *ctx,
+ u64 user_data, s32 res, u32 cflags)
{
struct io_uring_cqe *cqe;
@@ -704,6 +704,20 @@ bool io_fill_cqe_aux(struct io_ring_ctx *ctx, u64 user_data, s32 res,
return io_cqring_event_overflow(ctx, user_data, res, cflags, 0, 0);
}
+bool io_post_aux_cqe(struct io_ring_ctx *ctx,
+ u64 user_data, s32 res, u32 cflags)
+{
+ bool filled;
+
+ spin_lock(&ctx->completion_lock);
+ filled = io_fill_cqe_aux(ctx, user_data, res, cflags);
+ io_commit_cqring(ctx);
+ spin_unlock(&ctx->completion_lock);
+ if (filled)
+ io_cqring_ev_posted(ctx);
+ return filled;
+}
+
static void __io_req_complete_put(struct io_kiocb *req)
{
/*