diff --git a/foyer-storage/Cargo.toml b/foyer-storage/Cargo.toml index a98f4b2c..95a8a68e 100644 --- a/foyer-storage/Cargo.toml +++ b/foyer-storage/Cargo.toml @@ -25,13 +25,10 @@ foyer-memory = { version = "0.3", path = "../foyer-memory" } futures = "0.3" itertools = "0.12" lazy_static = "1" -libc = "0.2" lz4 = "1.24" memoffset = "0.9" parking_lot = { version = "0.12", features = ["arc_lock"] } -paste = "1.0" prometheus = "0.13" -rand = "0.8.5" serde = { workspace = true } thiserror = "1" tokio = { workspace = true } diff --git a/foyer-storage/src/device/fs.rs b/foyer-storage/src/device/fs.rs index 4cd0947c..185d0c90 100644 --- a/foyer-storage/src/device/fs.rs +++ b/foyer-storage/src/device/fs.rs @@ -26,6 +26,9 @@ use itertools::Itertools; use super::{allocator::AlignedAllocator, asyncify, Device, DeviceError, DeviceResult, IoBuf, IoBufMut, IoRange}; use crate::region::RegionId; +#[cfg(target_os = "linux")] +const O_DIRECT: i32 = 0x4000; + #[derive(Debug)] pub struct FsDeviceConfigBuilder { pub dir: PathBuf, @@ -301,7 +304,7 @@ impl FsDevice { { use std::os::unix::fs::OpenOptionsExt; if config.direct { - opts.custom_flags(libc::O_DIRECT); + opts.custom_flags(O_DIRECT); } }