block: Implement Geometry trait for RawFileDiskAio

Add disk_file::Geometry trait implementation for
RawFileDiskAio. Probes disk topology from the file,
falling back to defaults on failure. Takes &self instead
of &mut self and uses unwrap_or_else for cleaner error
handling.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2026-03-27 23:49:01 -07:00
committed by Wei Liu
parent df890599c2
commit 190380c9ba

View File

@@ -92,6 +92,15 @@ impl disk_file::DiskFd for RawFileDiskAio {
}
}
impl disk_file::Geometry for RawFileDiskAio {
fn topology(&self) -> DiskTopology {
DiskTopology::probe(&self.file).unwrap_or_else(|_| {
warn!("Unable to get device topology. Using default topology");
DiskTopology::default()
})
}
}
pub struct RawFileAsyncAio {
fd: RawFd,
ctx: aio::IoContext,