mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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 <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
ce9b49d98f
commit
616bafbe8e
@@ -45,15 +45,6 @@ impl AioDataIo {
|
|||||||
self.completions.notifier()
|
self.completions.notifier()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_unsafe)]
|
|
||||||
fn submit_iocbs(ctx: &aio::IoContext, iocbs: &[&mut aio::IoControlBlock]) -> io::Result<usize> {
|
|
||||||
// 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.
|
/// Submits one owned read or write operation to the queue.
|
||||||
///
|
///
|
||||||
/// Submission failures are converted into injected completions so callers
|
/// Submission failures are converted into injected completions so callers
|
||||||
@@ -84,7 +75,7 @@ impl AioDataIo {
|
|||||||
};
|
};
|
||||||
self.in_flight.insert(user_data, Some(op));
|
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(1) => return Ok(()),
|
||||||
Ok(_) => -libc::EAGAIN,
|
Ok(_) => -libc::EAGAIN,
|
||||||
Err(e) => errno_result(&e),
|
Err(e) => errno_result(&e),
|
||||||
@@ -114,7 +105,7 @@ impl AioDataIo {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
self.in_flight.insert(user_data, None);
|
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(1) => return Ok(()),
|
||||||
Ok(_) => -libc::EAGAIN,
|
Ok(_) => -libc::EAGAIN,
|
||||||
Err(e) => errno_result(&e),
|
Err(e) => errno_result(&e),
|
||||||
|
|||||||
Reference in New Issue
Block a user