Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/vinyl/io/ur/fd_vinyl_io_ur_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ void
fd_vinyl_io_ur_rewind( fd_vinyl_io_t * io,
ulong seq );

/* Auxiliary write path functions */
void
fd_vinyl_io_ur_rd_completion( fd_vinyl_io_ur_t * io );

void
fd_vinyl_io_wq_completion( fd_vinyl_io_ur_t * io );
fd_vinyl_io_ur_completion( fd_vinyl_io_ur_t * io );

/* io_uring userdata encoding ******************************************

Expand Down
16 changes: 11 additions & 5 deletions src/vinyl/io/ur/fd_vinyl_io_ur_rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ rq_prep_retry( fd_vinyl_io_ur_t * ur,
/* rq_completion consumes an io_uring CQE. Returns io_rd if a read job
completed, otherwise returns NULL. */

static fd_vinyl_io_rd_t *
static fd_vinyl_io_ur_rd_t *
rq_completion( fd_vinyl_io_ur_t * ur ) {
fd_io_uring_t * ring = ur->ring;

Expand Down Expand Up @@ -396,7 +396,13 @@ rq_completion( fd_vinyl_io_ur_t * ur ) {
return NULL;
}

return (fd_vinyl_io_rd_t *)rd;
return rd;
}

void
fd_vinyl_io_ur_rd_completion( fd_vinyl_io_ur_t * ur ) {
fd_vinyl_io_ur_rd_t * rd = rq_completion( ur );
rc_push( ur, rd );
}

/* fd_vinyl_io_ur_poll pops the next read completion. May block. */
Expand Down Expand Up @@ -457,13 +463,13 @@ fd_vinyl_io_ur_poll( fd_vinyl_io_t * io,
struct io_uring_cqe * cqe = fd_io_uring_cq_head( ring->cq );
if( FD_UNLIKELY( !cqe ) ) FD_LOG_CRIT(( "fd_io_uring_cq_head() returned NULL despite io_uring_cq_ready()>=1" ));
if( ur_udata_req_type( cqe->user_data )==UR_REQ_WRITE ) {
fd_vinyl_io_wq_completion( ur );
fd_vinyl_io_ur_completion( ur );
continue;
}

fd_vinyl_io_rd_t * rd = rq_completion( ur );
fd_vinyl_io_ur_rd_t * rd = rq_completion( ur );
if( FD_UNLIKELY( !rd ) ) continue;
*_rd = rd;
*_rd = (fd_vinyl_io_rd_t *)rd;
return FD_VINYL_SUCCESS;
}
}
11 changes: 4 additions & 7 deletions src/vinyl/io/ur/fd_vinyl_io_ur_wb.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ring. The ring mapping is not modulo, see wb_ring for details. */

void
fd_vinyl_io_wq_completion( fd_vinyl_io_ur_t * ur ) {
fd_vinyl_io_ur_completion( fd_vinyl_io_ur_t * ur ) {
fd_io_uring_t * ring = ur->ring;

FD_CRIT( ur->cqe_pending >0, "stray completion" );
Expand All @@ -42,7 +42,8 @@ fd_vinyl_io_wq_completion( fd_vinyl_io_ur_t * ur ) {
struct io_uring_cqe * cqe = fd_io_uring_cq_head( ring->cq );
if( FD_UNLIKELY( !cqe ) ) FD_LOG_CRIT(( "no write completion found" ));
if( ur_udata_req_type( cqe->user_data )!=UR_REQ_WRITE ) {
FD_LOG_CRIT(( "unexpected CQE type while flushing write queue" ));
fd_vinyl_io_ur_rd_completion( ur );
return;
}
int cqe_res = cqe->res;
if( cqe_res<0 ) {
Expand Down Expand Up @@ -72,7 +73,7 @@ static void
wq_clean( fd_vinyl_io_ur_t * ur ) {
fd_io_uring_t * ring = ur->ring;
while( fd_io_uring_cq_ready( ring->cq ) ) {
fd_vinyl_io_wq_completion( ur );
fd_vinyl_io_ur_completion( ur );
}
}

Expand Down Expand Up @@ -273,10 +274,6 @@ fd_vinyl_io_ur_append( fd_vinyl_io_t * io,
uchar const * src = (uchar const *)_src;
uchar * spad = fd_vinyl_io_ur_wb_buf( ur );

if( FD_UNLIKELY( ur->cqe_read_pending ) ) {
FD_LOG_CRIT(( "attempted to enqueue a write while there are still inflight reads" ));
}

/* Validate the input args. */

ulong seq_future = ur->base->seq_future; if( FD_UNLIKELY( !sz ) ) return seq_future;
Expand Down
Loading