Implement register_fixed_buffer for io_uring IO backend

This commit is contained in:
PThorpe92
2025-08-01 14:55:35 -04:00
parent 3048e4fa97
commit 9289dd7e9a

View File

@@ -460,6 +460,29 @@ impl IO for UringIO {
fn get_memory_io(&self) -> Arc<MemoryIO> {
Arc::new(MemoryIO::new())
}
fn register_fixed_buffer(&self, ptr: std::ptr::NonNull<u8>, len: usize) -> Result<()> {
turso_assert!(
len % 512 == 0,
"fixed buffer length must be logical block aligned"
);
let inner = self.inner.borrow_mut();
let default_id = 0;
unsafe {
// RL_MEMLOCK cap is typically 8MB, the current design is to have one large arena
// registered at startup and therefore we can simply use the zero index, falling back
// to similar logic as the existing buffer pool for cases where it is over capacity.
inner.ring.ring.submitter().register_buffers_update(
default_id,
&[libc::iovec {
iov_base: ptr.as_ptr() as *mut libc::c_void,
iov_len: len,
}],
None,
)?
};
Ok(())
}
}
impl Clock for UringIO {