mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-24 03:34:18 +01:00
use O_DIRECT for file read operations
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -954,6 +954,7 @@ dependencies = [
|
||||
"criterion",
|
||||
"fallible-iterator 0.3.0",
|
||||
"io-uring",
|
||||
"libc",
|
||||
"log",
|
||||
"mimalloc",
|
||||
"ordered-multimap",
|
||||
|
||||
@@ -27,6 +27,7 @@ mimalloc = { version = "*", default-features = false }
|
||||
anyhow = "1.0.75"
|
||||
cfg_block = "0.1.1"
|
||||
fallible-iterator = "0.3.0"
|
||||
libc = "0.2.155"
|
||||
log = "0.4.20"
|
||||
ordered-multimap = "0.7.1"
|
||||
sieve-cache = "0.1.4"
|
||||
|
||||
@@ -2,6 +2,7 @@ use super::{Completion, File, WriteCompletion, IO};
|
||||
use anyhow::Result;
|
||||
use log::trace;
|
||||
use std::cell::RefCell;
|
||||
use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::rc::Rc;
|
||||
|
||||
@@ -21,7 +22,11 @@ impl LinuxIO {
|
||||
impl IO for LinuxIO {
|
||||
fn open_file(&self, path: &str) -> Result<Rc<dyn File>> {
|
||||
trace!("open_file(path = {})", path);
|
||||
let file = std::fs::File::options().read(true).write(true).open(path)?;
|
||||
let file = std::fs::File::options()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.custom_flags(libc::O_DIRECT)
|
||||
.open(path)?;
|
||||
Ok(Rc::new(LinuxFile {
|
||||
ring: self.ring.clone(),
|
||||
file,
|
||||
|
||||
Reference in New Issue
Block a user