[PATCH liburing] src/queue: refactor io_uring_get_sqe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Inline __io_uring_get_sqe() and clean up ugly naming left from it being
a macro at some point.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
 src/queue.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/queue.c b/src/queue.c
index 16bd86b..768e34f 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -371,19 +371,6 @@ int io_uring_submit_and_wait(struct io_uring *ring, unsigned wait_nr)
 	return __io_uring_submit_and_wait(ring, wait_nr);
 }
 
-static inline struct io_uring_sqe *
-__io_uring_get_sqe(struct io_uring_sq *sq, unsigned int __head)
-{
-	unsigned int __next = (sq)->sqe_tail + 1;
-	struct io_uring_sqe *__sqe = NULL;
-
-	if (__next - __head <= *(sq)->kring_entries) {
-		__sqe = &(sq)->sqes[(sq)->sqe_tail & *(sq)->kring_mask];
-		(sq)->sqe_tail = __next;
-	}
-	return __sqe;
-}
-
 /*
  * Return an sqe to fill. Application must later call io_uring_submit()
  * when it's ready to tell the kernel about it. The caller may call this
@@ -394,8 +381,15 @@ __io_uring_get_sqe(struct io_uring_sq *sq, unsigned int __head)
 struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring)
 {
 	struct io_uring_sq *sq = &ring->sq;
+	unsigned int head = io_uring_smp_load_acquire(sq->khead);
+	unsigned int next = sq->sqe_tail + 1;
+	struct io_uring_sqe *sqe = NULL;
 
-	return __io_uring_get_sqe(sq, io_uring_smp_load_acquire(sq->khead));
+	if (next - head <= *sq->kring_entries) {
+		sqe = &sq->sqes[sq->sqe_tail & *sq->kring_mask];
+		sq->sqe_tail = next;
+	}
+	return sqe;
 }
 
 int __io_uring_sqring_wait(struct io_uring *ring)
-- 
2.24.0




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux