File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1139,6 +1139,19 @@ impl OpenOptions {
11391139 /// When enabled, reads and writes bypass the simulated page cache,
11401140 /// always incurring full I/O latency.
11411141 ///
1142+ /// # Durability Note
1143+ ///
1144+ /// In this simulation, O_DIRECT only affects **latency**, not **durability**.
1145+ /// Writes still require `sync_all()` to become crash-safe, regardless of
1146+ /// whether O_DIRECT is used. This is actually realistic: on real systems,
1147+ /// O_DIRECT bypasses the OS page cache but data can still sit in the drive's
1148+ /// volatile write cache. Only `fsync()` guarantees data reaches persistent
1149+ /// media.
1150+ ///
1151+ /// In practice, O_DIRECT writes are "closer" to disk (smaller device buffer
1152+ /// vs large OS page cache), but this simulation takes the conservative
1153+ /// approach of treating all non-synced writes equally for crash testing.
1154+ ///
11421155 /// # Example
11431156 ///
11441157 /// ```ignore
Original file line number Diff line number Diff line change @@ -467,6 +467,14 @@ impl OpenOptions {
467467 ///
468468 /// When enabled, reads and writes bypass the simulated page cache,
469469 /// always incurring full I/O latency.
470+ ///
471+ /// # Durability Note
472+ ///
473+ /// O_DIRECT only affects **latency**, not **durability**. Writes still require
474+ /// `sync_all()` to become crash-safe. See [`std::fs::OpenOptions::direct_io`]
475+ /// for details.
476+ ///
477+ /// [`std::fs::OpenOptions::direct_io`]: crate::fs::shim::std::fs::OpenOptions::direct_io
470478 pub fn direct_io ( & mut self , direct_io : bool ) -> & mut Self {
471479 self . inner . direct_io ( direct_io) ;
472480 self
You can’t perform that action at this time.
0 commit comments