Merge pull request #9597 from mr-raj12/fix-fdatasync-docstring

platform: fix fdatasync docstring, clarify OS-level vs HW-level flush
This commit is contained in:
TW 2026-05-08 23:34:09 +02:00 committed by GitHub
commit d9a8d992b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -271,9 +271,9 @@ import fcntl as fcntl_mod
def fdatasync(fd):
"""macOS fdatasync using F_FULLFSYNC for true data durability.
On macOS, os.fsync() only flushes to the drive's write cache.
fcntl F_FULLFSYNC flushes to persistent storage.
Falls back to os.fsync() if F_FULLFSYNC is not supported.
os.fsync() is an OS-level flush (kernel page cache -> drive write buffer).
F_FULLFSYNC additionally issues a HW-level flush (drive write buffer -> persistent storage).
Falls back to os.fsync() if F_FULLFSYNC is not supported (e.g. network fs).
"""
try:
fcntl_mod.fcntl(fd, fcntl_mod.F_FULLFSYNC)