Skip to content

Commit

Permalink
ioq: Copy ring_ops from the previous thread
Browse files Browse the repository at this point in the history
Otherwise threads 2-N won't use io_uring at all!  Oops.

Fixes: 8bc72d6 ("ioq: Probe for supported io_uring operations")
  • Loading branch information
tavianator committed Mar 6, 2024
1 parent 61adc84 commit f64f76b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ioq.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ static int ioq_ring_init(struct ioq *ioq, struct ioq_thread *thread) {

if (prev) {
// Initial setup already complete
thread->ring_ops = prev->ring_ops;
return 0;
}

Expand Down Expand Up @@ -916,12 +917,14 @@ static void ioq_thread_join(struct ioq_thread *thread) {
}

struct ioq *ioq_create(size_t depth, size_t nthreads) {
struct ioq *ioq = ZALLOC_FLEX(struct ioq, threads, nthreads);
struct ioq *ioq = ALLOC_FLEX(struct ioq, threads, nthreads);
if (!ioq) {
goto fail;
}

ioq->depth = depth;
ioq->size = 0;
ioq->cancel = false;

ARENA_INIT(&ioq->ents, struct ioq_ent);

Expand Down

0 comments on commit f64f76b

Please sign in to comment.