block: io: Rename SyncCompletionQueue to CompletionCommon

The Sync prefix is too narrow because the queue is not tied to
synchronous execution. Rename it to CompletionCommon, following the
Common suffix the codebase already uses for shared helper types such
as VirtioCommon. The queue holds no engine specific state, so it can
be reused more widely across backends.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-07-25 14:59:26 +02:00
committed by Rob Bradford
parent 5e01807fa2
commit 636d8a83ca
5 changed files with 13 additions and 13 deletions

View File

@@ -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<dyn Decoder>,
completions: SyncCompletionQueue,
completions: CompletionCommon,
}
impl QcowSync {
@@ -47,7 +47,7 @@ impl QcowSync {
data_file,
backing_file,
sparse,
completions: SyncCompletionQueue::new(),
completions: CompletionCommon::new(),
}
}

View File

@@ -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,
}

View File

@@ -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<Mutex<Vhdx>>,
completions: SyncCompletionQueue,
completions: CompletionCommon,
size: u64,
}
@@ -24,7 +24,7 @@ impl VhdxSync {
pub(super) fn new(vhdx_file: Arc<Mutex<Vhdx>>, size: u64) -> Self {
VhdxSync {
vhdx_file,
completions: SyncCompletionQueue::new(),
completions: CompletionCommon::new(),
size,
}
}

View File

@@ -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;

View File

@@ -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<AsyncIoCompletion>,
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"),
}
}