Skip to content

Commit

Permalink
fix: fusion driver miss release_buffer_pool implement
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherlock-Holo committed Jul 11, 2024
1 parent 66004c7 commit 88468fc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
16 changes: 16 additions & 0 deletions compio-driver/src/fusion/buffer_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ impl BufferPool {
inner: BufferPollInner::Poll(buffer_pool),
}
}

pub(crate) fn into_poll(self) -> crate::fallback_buffer_pool::BufferPool {
match self.inner {
BufferPollInner::IoUring(_) => {
panic!("BufferPool type is not io-uring type")
}
BufferPollInner::Poll(inner) => inner,
}
}

pub(crate) fn into_io_uring(self) -> super::iour::buffer_pool::BufferPool {
match self.inner {
BufferPollInner::IoUring(inner) => inner,
BufferPollInner::Poll(_) => panic!("BufferPool type is not poll type"),
}
}
}

enum BufferPollInner {
Expand Down
7 changes: 5 additions & 2 deletions compio-driver/src/fusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,11 @@ impl Driver {
/// # Safety
///
/// caller must make sure release the buffer pool with correct driver
pub unsafe fn release_buffer_pool(&mut self, _: BufferPool) -> io::Result<()> {
todo!()
pub unsafe fn release_buffer_pool(&mut self, buffer_pool: BufferPool) -> io::Result<()> {
match &mut self.fuse {
FuseDriver::Poll(driver) => driver.release_buffer_pool(buffer_pool.into_poll()),
FuseDriver::IoUring(driver) => driver.release_buffer_pool(buffer_pool.into_io_uring()),
}
}
}

Expand Down

0 comments on commit 88468fc

Please sign in to comment.