Skip to content

Commit

Permalink
Remove page cache flush code
Browse files Browse the repository at this point in the history
This is no longer needed for memory safety now that the mmap backend has
been removed
  • Loading branch information
cberner committed Nov 5, 2023
1 parent d8c63a9 commit 7da7eea
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/tree_store/page_store/file_backend/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ impl FileBackend {
Err(err.into())
}
} else {
// Try to flush any pages in the page cache that are out of sync with disk.
// See here for why: <https://github.com/cberner/redb/issues/450>
#[cfg(target_os = "linux")]
unsafe {
libc::posix_fadvise64(fd, 0, 0, libc::POSIX_FADV_DONTNEED);
}
Ok(Self { file })
}
}
Expand All @@ -71,16 +65,7 @@ impl StorageBackend for FileBackend {

#[cfg(not(target_os = "macos"))]
fn sync_data(&self, _: bool) -> Result<(), io::Error> {
let res = self.file.sync_data();
#[cfg(target_os = "linux")]
if res.is_err() {
// Try to flush any pages in the page cache that are out of sync with disk.
// See here for why: <https://github.com/cberner/redb/issues/450>
unsafe {
libc::posix_fadvise64(self.file.as_raw_fd(), 0, 0, libc::POSIX_FADV_DONTNEED);
}
}
res
self.file.sync_data()
}

#[cfg(target_os = "macos")]
Expand Down

0 comments on commit 7da7eea

Please sign in to comment.