Skip to content

Commit 78bbdbe

Browse files
russell-islamliuw
authored andcommitted
block: Implement PhysicalSize trait for RawFileDiskAio
Add disk_file::PhysicalSize trait implementation for RawFileDiskAio. Returns the physical size from query_device_size wrapped in BlockError on failure, consistent with the DiskSize impl. Signed-off-by: Muminul Islam <muislam@microsoft.com>
1 parent fca54cb commit 78bbdbe

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

block/src/raw_async_aio.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ impl disk_file::DiskSize for RawFileDiskAio {
7878
}
7979
}
8080

81+
impl disk_file::PhysicalSize for RawFileDiskAio {
82+
fn physical_size(&self) -> BlockResult<u64> {
83+
query_device_size(&self.file)
84+
.map(|(_, physical_size)| physical_size)
85+
.map_err(|e| BlockError::new(BlockErrorKind::Io, DiskFileError::Size(e)))
86+
}
87+
}
88+
8189
pub struct RawFileAsyncAio {
8290
fd: RawFd,
8391
ctx: aio::IoContext,

0 commit comments

Comments
 (0)