MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / create_async_io

Method create_async_io

block/src/qcow_disk.rs:158–187  ·  view source on GitHub ↗
(&self, ring_depth: u32)

Source from the content-addressed store, hash-verified

156 }
157
158 fn create_async_io(&self, ring_depth: u32) -> BlockResult<Box<dyn AsyncIo>> {
159 if self.use_io_uring {
160 #[cfg(feature = "io_uring")]
161 {
162 return Ok(Box::new(
163 QcowAsync::new(
164 Arc::clone(&self.metadata),
165 self.data_raw_file.clone(),
166 self.backing_file.as_ref().map(Arc::clone),
167 self.sparse,
168 ring_depth,
169 )
170 .map_err(|e| {
171 BlockError::new(BlockErrorKind::Io, DiskFileError::NewAsyncIo(e))
172 })?,
173 ));
174 }
175
176 #[cfg(not(feature = "io_uring"))]
177 unreachable!("use_io_uring is set but io_uring feature is not enabled");
178 }
179
180 let _ = ring_depth;
181 Ok(Box::new(QcowSync::new(
182 Arc::clone(&self.metadata),
183 self.data_raw_file.clone(),
184 self.backing_file.as_ref().map(Arc::clone),
185 self.sparse,
186 )))
187 }
188}
189
190#[cfg(test)]

Callers 1

assert_async_io_from_dynFunction · 0.45

Calls 3

newFunction · 0.85
cloneMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected