block: Implement Geometry trait for RawFileDisk

Add disk_file::Geometry trait implementation for RawFileDisk.
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:24:54 -07:00
committed by Bo Chen
parent ca1f48a717
commit 7e514d8d0e

View File

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