src/queue: refactor io_uring_get_sqe()
Inline __io_uring_get_sqe() and clean up ugly naming left from it being
a macro at some point.
@@ -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)
