fsync(2) manual and hdd write caching

perryh at pluto.rain.com perryh at pluto.rain.com
Wed Oct 27 09:40:18 UTC 2010


Ivan Voras <ivoras at freebsd.org> wrote:
> fsync(2) actually does behave as advertised, "auses all modified
> data and attributes of fd to be moved to a permanent storage
> device". It is the problem of the "permanent storage device"
> if it caches this data further.

IMO, volatile RAM without battery backup cannot reasonably be
considered a "permanent storage device", regardless of where
it is physically located.

Short of mounting synchronously, with the attendant performance
hit, would it not make sense for fsync(2) to issue ATA_FLUSHCACHE
or SCSI "SYNCHRONIZE CACHE" after it has finished writing data
to the drive?  Surely the low-level capability to issue those
commands must already exist, else we would have no way to safely
prepare for power off.


More information about the freebsd-hackers mailing list