diff --git a/block/src/formats/qcow/engine_sync.rs b/block/src/formats/qcow/engine_sync.rs index 1d0ae3bbf..488ebf7c4 100644 --- a/block/src/formats/qcow/engine_sync.rs +++ b/block/src/formats/qcow/engine_sync.rs @@ -19,7 +19,7 @@ use super::metadata::{ }; use super::qcow_raw_file::QcowRawFile; use crate::async_io::{ - AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult, SyncCompletionQueue, + AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult, CompletionCommon, }; pub(super) struct QcowSync { @@ -30,7 +30,7 @@ pub(super) struct QcowSync { sparse: bool, cluster_size: u64, decoder: Arc, - completions: SyncCompletionQueue, + completions: CompletionCommon, } impl QcowSync { @@ -47,7 +47,7 @@ impl QcowSync { data_file, backing_file, sparse, - completions: SyncCompletionQueue::new(), + completions: CompletionCommon::new(), } } diff --git a/block/src/formats/raw/engine_sync.rs b/block/src/formats/raw/engine_sync.rs index 1496738d6..884b03430 100644 --- a/block/src/formats/raw/engine_sync.rs +++ b/block/src/formats/raw/engine_sync.rs @@ -10,14 +10,14 @@ use std::os::unix::io::AsRawFd; use vmm_sys_util::eventfd::EventFd; use crate::async_io::{ - AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult, SyncCompletionQueue, + AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult, CompletionCommon, }; use crate::sparse::{punch_hole, write_zeroes}; use crate::{AlignedFile, is_block_device}; pub(crate) struct RawSync { raw_file: AlignedFile, - completions: SyncCompletionQueue, + completions: CompletionCommon, alignment: u64, is_block_device: bool, } @@ -28,7 +28,7 @@ impl RawSync { let alignment = raw_file.alignment() as u64; RawSync { raw_file, - completions: SyncCompletionQueue::new(), + completions: CompletionCommon::new(), alignment, is_block_device, } diff --git a/block/src/formats/vhdx/engine_sync.rs b/block/src/formats/vhdx/engine_sync.rs index 8e3c40971..12b1f027a 100644 --- a/block/src/formats/vhdx/engine_sync.rs +++ b/block/src/formats/vhdx/engine_sync.rs @@ -10,13 +10,13 @@ use std::sync::{Arc, Mutex}; use vmm_sys_util::eventfd::EventFd; use crate::async_io::{ - AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult, SyncCompletionQueue, + AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult, CompletionCommon, }; use crate::formats::vhdx::Vhdx; pub(super) struct VhdxSync { vhdx_file: Arc>, - completions: SyncCompletionQueue, + completions: CompletionCommon, size: u64, } @@ -24,7 +24,7 @@ impl VhdxSync { pub(super) fn new(vhdx_file: Arc>, size: u64) -> Self { VhdxSync { vhdx_file, - completions: SyncCompletionQueue::new(), + completions: CompletionCommon::new(), size, } } diff --git a/block/src/io/async_io.rs b/block/src/io/async_io.rs index a8b4c7703..19e832580 100644 --- a/block/src/io/async_io.rs +++ b/block/src/io/async_io.rs @@ -17,7 +17,7 @@ use std::{io, result}; pub use aio_data_io::AioDataIo; pub use completion::AsyncIoCompletion; -pub(crate) use completion::SyncCompletionQueue; +pub(crate) use completion::CompletionCommon; pub use guest_memory_target::GuestMemoryTarget; pub use operation::AsyncIoOperation; pub use owned_io_buffer::OwnedIoBuffer; diff --git a/block/src/io/async_io/completion.rs b/block/src/io/async_io/completion.rs index 01b664b9f..20d9eba55 100644 --- a/block/src/io/async_io/completion.rs +++ b/block/src/io/async_io/completion.rs @@ -48,17 +48,17 @@ impl AsyncIoCompletion { /// Pending completions plus the eventfd that signals the device to /// drain them. Sync engines run each operation inline, enqueue its /// completion, and signal the eventfd. -pub(crate) struct SyncCompletionQueue { +pub(crate) struct CompletionCommon { queue: VecDeque, eventfd: EventFd, } -impl SyncCompletionQueue { +impl CompletionCommon { pub(crate) fn new() -> Self { Self { queue: VecDeque::new(), eventfd: EventFd::new(libc::EFD_NONBLOCK) - .expect("Failed creating EventFd for sync completion queue"), + .expect("Failed creating EventFd for the completion queue"), } }