Skip to content

Commit ff12617

Browse files
isilenceaxboe
authored andcommitted
io_uring: inline __io_cq_unlock
__io_cq_unlock is not very helpful, and users should be calling flush variants anyway. Open code the function. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/d875c4cfb69f38ccecb58a57111446c77a614caa.1687518903.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 55b6a69 commit ff12617

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

io_uring/io_uring.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,6 @@ static inline void __io_cq_lock(struct io_ring_ctx *ctx)
631631
spin_lock(&ctx->completion_lock);
632632
}
633633

634-
static inline void __io_cq_unlock(struct io_ring_ctx *ctx)
635-
{
636-
if (!ctx->task_complete)
637-
spin_unlock(&ctx->completion_lock);
638-
}
639-
640634
static inline void io_cq_lock(struct io_ring_ctx *ctx)
641635
__acquires(ctx->completion_lock)
642636
{
@@ -647,7 +641,9 @@ static inline void io_cq_lock(struct io_ring_ctx *ctx)
647641
static inline void __io_cq_unlock_post(struct io_ring_ctx *ctx)
648642
{
649643
io_commit_cqring(ctx);
650-
__io_cq_unlock(ctx);
644+
if (!ctx->task_complete)
645+
spin_unlock(&ctx->completion_lock);
646+
651647
io_commit_cqring_flush(ctx);
652648
io_cqring_wake(ctx);
653649
}
@@ -664,7 +660,7 @@ static void __io_cq_unlock_post_flush(struct io_ring_ctx *ctx)
664660
*/
665661
io_commit_cqring_flush(ctx);
666662
} else {
667-
__io_cq_unlock(ctx);
663+
spin_unlock(&ctx->completion_lock);
668664
io_commit_cqring_flush(ctx);
669665
io_cqring_wake(ctx);
670666
}

0 commit comments

Comments
 (0)