Skip to content

Commit 190380c

Browse files
russell-islamliuw
authored andcommitted
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>
1 parent df89059 commit 190380c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

block/src/raw_async_aio.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ impl disk_file::DiskFd for RawFileDiskAio {
9292
}
9393
}
9494

95+
impl disk_file::Geometry for RawFileDiskAio {
96+
fn topology(&self) -> DiskTopology {
97+
DiskTopology::probe(&self.file).unwrap_or_else(|_| {
98+
warn!("Unable to get device topology. Using default topology");
99+
DiskTopology::default()
100+
})
101+
}
102+
}
103+
95104
pub struct RawFileAsyncAio {
96105
fd: RawFd,
97106
ctx: aio::IoContext,

0 commit comments

Comments
 (0)