mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: qcow_async: impl AsyncDiskFile for QcowDiskAsync
try_clone shares the Arc wrapped metadata and backing file. new_async_io creates a QcowAsync worker with its own io_uring instance for the given ring depth. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
261361c1b0
commit
ffc579b913
@@ -134,6 +134,30 @@ impl disk_file::Resizable for QcowDiskAsync {
|
|||||||
|
|
||||||
impl disk_file::DiskFile for QcowDiskAsync {}
|
impl disk_file::DiskFile for QcowDiskAsync {}
|
||||||
|
|
||||||
|
impl disk_file::AsyncDiskFile for QcowDiskAsync {
|
||||||
|
fn try_clone(&self) -> BlockResult<Box<dyn disk_file::AsyncDiskFile>> {
|
||||||
|
Ok(Box::new(QcowDiskAsync {
|
||||||
|
metadata: Arc::clone(&self.metadata),
|
||||||
|
backing_file: self.backing_file.as_ref().map(Arc::clone),
|
||||||
|
sparse: self.sparse,
|
||||||
|
data_raw_file: self.data_raw_file.clone(),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_async_io(&self, ring_depth: u32) -> BlockResult<Box<dyn AsyncIo>> {
|
||||||
|
Ok(Box::new(
|
||||||
|
QcowAsync::new(
|
||||||
|
Arc::clone(&self.metadata),
|
||||||
|
self.data_raw_file.clone(),
|
||||||
|
self.backing_file.as_ref().map(Arc::clone),
|
||||||
|
self.sparse,
|
||||||
|
ring_depth,
|
||||||
|
)
|
||||||
|
.map_err(|e| BlockError::new(BlockErrorKind::Io, DiskFileError::NewAsyncIo(e)))?,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Per queue QCOW2 I/O worker using io_uring.
|
/// Per queue QCOW2 I/O worker using io_uring.
|
||||||
///
|
///
|
||||||
/// Reads against fully allocated single mapping clusters are submitted
|
/// Reads against fully allocated single mapping clusters are submitted
|
||||||
|
|||||||
Reference in New Issue
Block a user