(
metadata: &QcowMetadata,
data_file: &QcowRawFile,
backing_file: &Option<Arc<dyn BackingRead>>,
address: u64,
iovecs: &[libc::iovec],
total_len: usize,
| 341 | /// synchronously via `scatter_read_sync` and returns `None`. |
| 342 | #[allow(clippy::too_many_arguments)] |
| 343 | fn resolve_read( |
| 344 | metadata: &QcowMetadata, |
| 345 | data_file: &QcowRawFile, |
| 346 | backing_file: &Option<Arc<dyn BackingRead>>, |
| 347 | address: u64, |
| 348 | iovecs: &[libc::iovec], |
| 349 | total_len: usize, |
| 350 | alignment: usize, |
| 351 | cluster_size: u64, |
| 352 | decoder: &dyn Decoder, |
| 353 | ) -> AsyncIoResult<Option<u64>> { |
| 354 | let has_backing = backing_file.is_some(); |
| 355 | let mappings = metadata |
| 356 | .map_clusters_for_read(address, total_len, has_backing) |
| 357 | .map_err(AsyncIoError::ReadVectored)?; |
| 358 | |
| 359 | // The fast path returns a host offset so the caller can submit a |
| 360 | // single io_uring readv with the original iovecs. This only works |
| 361 | // without O_DIRECT because it requires I/O |
| 362 | // size and file offset to be multiples of the device sector size. |
| 363 | // Guest requests can be smaller (e.g. 512 byte UEFI reads on a |
| 364 | // 4096 byte sector device), so O_DIRECT reads fall through to the |
| 365 | // alignment aware synchronous path instead. |
| 366 | if alignment == 0 |
| 367 | && mappings.len() == 1 |
| 368 | && let ClusterReadMapping::Allocated { |
| 369 | offset: host_offset, |
| 370 | length, |
| 371 | } = &mappings[0] |
| 372 | && *length as usize == total_len |
| 373 | { |
| 374 | return Ok(Some(*host_offset)); |
| 375 | } |
| 376 | |
| 377 | Self::scatter_read_sync( |
| 378 | mappings, |
| 379 | iovecs, |
| 380 | data_file, |
| 381 | backing_file, |
| 382 | alignment, |
| 383 | cluster_size, |
| 384 | decoder, |
| 385 | )?; |
| 386 | Ok(None) |
| 387 | } |
| 388 | |
| 389 | /// Scatter-read cluster mappings synchronously into iovec buffers. |
| 390 | fn scatter_read_sync( |
nothing calls this directly
no test coverage detected