@@ -116,6 +116,7 @@ struct fd_snaplh_tile {
116116 /* io_uring setup */
117117
118118 fd_io_uring_t ioring [1 ];
119+ int io_uring_enabled ;
119120};
120121
121122typedef struct fd_snaplh_tile fd_snaplh_t ;
@@ -314,7 +315,7 @@ handle_vinyl_lthash_compute_from_rd_req( fd_snaplh_t * ctx,
314315static inline ulong
315316consume_available_cqe ( fd_snaplh_t * ctx ) {
316317 if ( FD_LIKELY ( !ctx -> vinyl .pending_rd_req_cnt ) ) return 0UL ;
317- if ( ctx -> vinyl . io -> type != FD_VINYL_IO_TYPE_UR ) return 0UL ;
318+ if ( FD_UNLIKELY ( ! ctx -> io_uring_enabled ) ) return 0UL ;
318319 if ( !fd_io_uring_cq_ready ( ctx -> ioring -> cq ) ) return 0UL ;
319320
320321 /* At this point, there is at least one unconsumed CQE */
@@ -478,7 +479,7 @@ handle_lv_data_frag( fd_snaplh_t * ctx,
478479 fd_vinyl_bstream_phdr_t acc_hdr [1 ];
479480 memcpy ( & seq , indata , sizeof (ulong ) );
480481 memcpy ( acc_hdr , indata + sizeof (ulong ), sizeof (fd_vinyl_bstream_phdr_t ) );
481- if ( FD_LIKELY ( ctx -> vinyl . io -> type == FD_VINYL_IO_TYPE_UR ) ) {
482+ if ( FD_LIKELY ( ctx -> io_uring_enabled ) ) {
482483 handle_vinyl_lthash_request_ur ( ctx , seq , acc_hdr );
483484 } else {
484485 handle_vinyl_lthash_request_bd ( ctx , seq , acc_hdr );
@@ -531,7 +532,7 @@ handle_control_frag( fd_snaplh_t * ctx,
531532 ctx -> state = FD_SNAPSHOT_STATE_FINISHING ;
532533
533534 if ( ctx -> state == FD_SNAPSHOT_STATE_FINISHING ) {
534- if ( FD_LIKELY ( ctx -> vinyl . io -> type == FD_VINYL_IO_TYPE_UR ) ) {
535+ if ( FD_LIKELY ( ctx -> io_uring_enabled ) ) {
535536 handle_vinyl_lthash_request_ur_consume_all ( ctx );
536537 }
537538 ctx -> state = handle_lthash_completion ( ctx , stem );
@@ -612,7 +613,7 @@ during_housekeeping( fd_snaplh_t * ctx ) {
612613
613614 /* Service io_uring instance */
614615
615- if ( ctx -> vinyl . io -> type == FD_VINYL_IO_TYPE_UR ) {
616+ if ( FD_LIKELY ( ctx -> io_uring_enabled ) ) {
616617 uint sq_drops = fd_io_uring_sq_dropped ( ctx -> ioring -> sq );
617618 if ( FD_UNLIKELY ( sq_drops ) ) {
618619 FD_LOG_CRIT (( "kernel io_uring dropped I/O requests, cannot continue (sq_dropped=%u)" , sq_drops ));
@@ -750,6 +751,7 @@ privileged_init( fd_topo_t * topo,
750751 if ( FD_LIKELY ( tile -> snaplh .io_uring_enabled ) ) {
751752 ctx -> vinyl .io = snaplh_io_uring_init ( ctx , uring_shmem , uring_mem , dev_fd );
752753 }
754+ ctx -> io_uring_enabled = tile -> snaplh .io_uring_enabled ;
753755}
754756
755757static void
@@ -761,8 +763,7 @@ unprivileged_init( fd_topo_t * topo,
761763 fd_snaplh_t * ctx = FD_SCRATCH_ALLOC_APPEND ( l , alignof(fd_snaplh_t ), sizeof (fd_snaplh_t ) );
762764 void * pair_mem = FD_SCRATCH_ALLOC_APPEND ( l , VINYL_LTHASH_BLOCK_ALIGN , VINYL_LTHASH_BLOCK_MAX_SZ );
763765 void * pair_tmp = FD_SCRATCH_ALLOC_APPEND ( l , VINYL_LTHASH_BLOCK_ALIGN , VINYL_LTHASH_BLOCK_MAX_SZ );
764- void * rd_req_mem = NULL ;
765- rd_req_mem = FD_SCRATCH_ALLOC_APPEND ( l , VINYL_LTHASH_BLOCK_ALIGN , VINYL_LTHASH_RD_REQ_MAX * VINYL_LTHASH_BLOCK_MAX_SZ );
766+ void * rd_req_mem = FD_SCRATCH_ALLOC_APPEND ( l , VINYL_LTHASH_BLOCK_ALIGN , VINYL_LTHASH_RD_REQ_MAX * VINYL_LTHASH_BLOCK_MAX_SZ );
766767
767768 FD_TEST ( fd_topo_tile_name_cnt ( topo , "snaplh" )<=FD_SNAPSHOT_MAX_SNAPLH_TILES );
768769
0 commit comments