From d88e8c91a26150de2be19fcb776ec308e77f78a3 Mon Sep 17 00:00:00 2001 From: Caleb Sander Mateos Date: Sat, 31 May 2025 11:25:16 -0600 Subject: [PATCH] engines/io_uring: remove unnecessary SQ full check fio_ioring_queue() bails out if the SQ's tail + 1 == head. This will always be false, since 0 <= tail - head <= entries. Probably it was meant to check whether the SQ is full, i.e. tail == head + entries. (The head index should be loaded with acquire ordering in that case.) Checking for a full SQ isn't necessary anyways, as the prior check for ld->queued == td->o.iodepth already ensures the SQ isn't full. So remove the unnecessary and misleading tail + 1 == head check. Signed-off-by: Caleb Sander Mateos --- engines/io_uring.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 08f220c8..51228037 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -775,7 +775,7 @@ static enum fio_q_status fio_ioring_queue(struct thread_data *td, struct ioring_data *ld = td->io_ops_data; struct ioring_options *o = td->eo; struct io_sq_ring *ring = &ld->sq_ring; - unsigned tail, next_tail; + unsigned tail; fio_ro_check(td, io_u); @@ -795,11 +795,6 @@ static enum fio_q_status fio_ioring_queue(struct thread_data *td, return FIO_Q_COMPLETED; } - tail = *ring->tail; - next_tail = tail + 1; - if (next_tail == atomic_load_relaxed(ring->head)) - return FIO_Q_BUSY; - if (ld->cmdprio.mode != CMDPRIO_MODE_NONE) fio_ioring_cmdprio_prep(td, io_u); @@ -807,8 +802,9 @@ static enum fio_q_status fio_ioring_queue(struct thread_data *td, o->cmd_type == FIO_URING_CMD_NVME) fio_ioring_cmd_nvme_pi(td, io_u); + tail = *ring->tail; ring->array[tail & ld->sq_ring_mask] = io_u->index; - atomic_store_release(ring->tail, next_tail); + atomic_store_release(ring->tail, tail + 1); ld->queued++; return FIO_Q_QUEUED; -- 2.25.1