block: Implement PhysicalSize trait for RawFileDiskAio

Add disk_file::PhysicalSize trait implementation for
RawFileDiskAio. Returns the physical size from
query_device_size wrapped in BlockError on failure,
consistent with the DiskSize impl.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2026-03-27 23:48:18 -07:00
committed by Wei Liu
parent fca54cb142
commit 78bbdbef86

View File

@@ -78,6 +78,14 @@ impl disk_file::DiskSize for RawFileDiskAio {
}
}
impl disk_file::PhysicalSize for RawFileDiskAio {
fn physical_size(&self) -> BlockResult<u64> {
query_device_size(&self.file)
.map(|(_, physical_size)| physical_size)
.map_err(|e| BlockError::new(BlockErrorKind::Io, DiskFileError::Size(e)))
}
}
pub struct RawFileAsyncAio {
fd: RawFd,
ctx: aio::IoContext,