block: Use FixedVhdDisk in factory, remove old wrappers

Update open_fixed_vhd to construct FixedVhdDisk instead of choosing
between FixedVhdDiskAsync and FixedVhdDiskSync. The io_uring decision
is now made inside FixedVhdDisk::create_async_io().

Remove FixedVhdDiskSync and FixedVhdDiskAsync DiskFile wrapper structs
from fixed_vhd_sync.rs and fixed_vhd_async.rs. Only the FixedVhdSync
and FixedVhdAsync AsyncIo worker structs remain in those files.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-04-22 22:10:08 +02:00
committed by Bo Chen
parent cb13100fe3
commit d42ea61a5f
3 changed files with 9 additions and 158 deletions

View File

@@ -20,9 +20,7 @@ use log::info;
use crate::block_io_uring_is_supported;
use crate::disk_file::AsyncFullDiskFile;
use crate::error::{BlockError, BlockErrorKind, BlockResult};
#[cfg(feature = "io_uring")]
use crate::fixed_vhd_async::FixedVhdDiskAsync;
use crate::fixed_vhd_sync::FixedVhdDiskSync;
use crate::fixed_vhd_disk::FixedVhdDisk;
#[cfg(feature = "io_uring")]
use crate::qcow_async::QcowDiskAsync;
use crate::qcow_sync::QcowDiskSync;
@@ -131,7 +129,7 @@ fn open_fixed_vhd(
if io_uring_supported() {
info!("Opening fixed VHD disk file with io_uring backend");
return Ok(Box::new(
FixedVhdDiskAsync::new(file).map_err(|e| e.with_path(options.path))?,
FixedVhdDisk::new(file, true).map_err(|e| e.with_path(options.path))?,
));
}
info!("io_uring runtime probe failed for fixed VHD, using synchronous backend");
@@ -139,7 +137,7 @@ fn open_fixed_vhd(
info!("Opening fixed VHD disk file with synchronous backend");
Ok(Box::new(
FixedVhdDiskSync::new(file).map_err(|e| e.with_path(options.path))?,
FixedVhdDisk::new(file, false).map_err(|e| e.with_path(options.path))?,
))
}