From 616bafbe8ef017cb29476a3aaf98386706c971a6 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 25 Jul 2026 15:05:32 +0200 Subject: [PATCH] block: io: Drop the redundant unsafe around the aio submit vmm_sys_util marks IoContext::submit as a safe function, so the unsafe block was inert and only silenced by allow(unused_unsafe). Call submit directly. Signed-off-by: Anatol Belski --- block/src/io/async_io/aio_data_io.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/block/src/io/async_io/aio_data_io.rs b/block/src/io/async_io/aio_data_io.rs index 6914ca139..85ea4df61 100644 --- a/block/src/io/async_io/aio_data_io.rs +++ b/block/src/io/async_io/aio_data_io.rs @@ -45,15 +45,6 @@ impl AioDataIo { self.completions.notifier() } - #[allow(unused_unsafe)] - fn submit_iocbs(ctx: &aio::IoContext, iocbs: &[&mut aio::IoControlBlock]) -> io::Result { - // SAFETY: vmm_sys_util currently marks IoContext::submit safe, but - // io_submit consumes raw pointers asynchronously. Callers must ensure - // all iovec and buffer memory referenced by each iocb remains valid - // until completion or failed submission. - unsafe { ctx.submit(iocbs) } - } - /// Submits one owned read or write operation to the queue. /// /// Submission failures are converted into injected completions so callers @@ -84,7 +75,7 @@ impl AioDataIo { }; self.in_flight.insert(user_data, Some(op)); - let result = match Self::submit_iocbs(&self.ctx, &[&mut iocb]) { + let result = match self.ctx.submit(&[&mut iocb]) { Ok(1) => return Ok(()), Ok(_) => -libc::EAGAIN, Err(e) => errno_result(&e), @@ -114,7 +105,7 @@ impl AioDataIo { ..Default::default() }; self.in_flight.insert(user_data, None); - let result = match Self::submit_iocbs(&self.ctx, &[&mut iocb]) { + let result = match self.ctx.submit(&[&mut iocb]) { Ok(1) => return Ok(()), Ok(_) => -libc::EAGAIN, Err(e) => errno_result(&e),