From 190380c9bad3563f6d5bfb3885aafe6ea09b45fd Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Fri, 27 Mar 2026 23:49:01 -0700 Subject: [PATCH] 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 --- block/src/raw_async_aio.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/src/raw_async_aio.rs b/block/src/raw_async_aio.rs index 86b9271cf..6c1fe0aad 100644 --- a/block/src/raw_async_aio.rs +++ b/block/src/raw_async_aio.rs @@ -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,