block: Remove legacy DiskFile impl from RawFileDiskAio

Remove the old async_io::DiskFile trait implementation from
RawFileDiskAio, now that the new disk_file trait hierarchy
is fully implemented.

Clean up unused imports: DiskFile and DiskFileResult from
crate::async_io.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2026-03-27 23:51:43 -07:00
committed by Wei Liu
parent 6df7cda4ad
commit 783cc8bbd9
2 changed files with 2 additions and 44 deletions

View File

@@ -14,9 +14,7 @@ use log::warn;
use vmm_sys_util::aio;
use vmm_sys_util::eventfd::EventFd;
use crate::async_io::{
AsyncIo, AsyncIoError, AsyncIoResult, BorrowedDiskFd, DiskFile, DiskFileError, DiskFileResult,
};
use crate::async_io::{AsyncIo, AsyncIoError, AsyncIoResult, BorrowedDiskFd, DiskFileError};
use crate::error::{BlockError, BlockErrorKind, BlockResult};
use crate::{DiskTopology, SECTOR_SIZE, disk_file, probe_sparse_support, query_device_size};
@@ -31,45 +29,6 @@ impl RawFileDiskAio {
}
}
impl DiskFile for RawFileDiskAio {
fn logical_size(&mut self) -> DiskFileResult<u64> {
Ok(query_device_size(&self.file)
.map_err(DiskFileError::Size)?
.0)
}
fn physical_size(&mut self) -> DiskFileResult<u64> {
Ok(query_device_size(&self.file)
.map_err(DiskFileError::Size)?
.1)
}
fn new_async_io(&self, ring_depth: u32) -> DiskFileResult<Box<dyn AsyncIo>> {
let mut raw = RawFileAsyncAio::new(self.file.as_raw_fd(), ring_depth)
.map_err(DiskFileError::NewAsyncIo)?;
raw.alignment =
DiskTopology::probe(&self.file).map_or(SECTOR_SIZE, |t| t.logical_block_size);
Ok(Box::new(raw) as Box<dyn AsyncIo>)
}
fn topology(&mut self) -> DiskTopology {
if let Ok(topology) = DiskTopology::probe(&self.file) {
topology
} else {
warn!("Unable to get device topology. Using default topology");
DiskTopology::default()
}
}
fn supports_sparse_operations(&self) -> bool {
probe_sparse_support(&self.file)
}
fn fd(&mut self) -> BorrowedDiskFd<'_> {
BorrowedDiskFd::new(self.file.as_raw_fd())
}
}
impl disk_file::DiskSize for RawFileDiskAio {
fn logical_size(&self) -> BlockResult<u64> {
query_device_size(&self.file)