block: Implement Geometry trait for RawFileDiskSync

Add disk_file::Geometry trait implementation for
RawFileDiskSync. 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-24 17:35:39 -07:00
committed by Bo Chen
parent bd026ce4cb
commit aa5aa6fe89

View File

@@ -87,6 +87,15 @@ impl disk_file::DiskFd for RawFileDiskSync {
}
}
impl disk_file::Geometry for RawFileDiskSync {
fn topology(&self) -> DiskTopology {
DiskTopology::probe(&self.file).unwrap_or_else(|_| {
warn!("Unable to get device topology. Using default topology");
DiskTopology::default()
})
}
}
pub struct RawFileSync {
fd: RawFd,
eventfd: EventFd,