2 ms·
fsync doesn't have to "perform", because it doesn't have to do anything. It just has to wait for some certain events to occur that will eventually occur anyway.
by kazinator 3y ago
fsync doesn't have to "perform", because it doesn't have to do anything. It just has to wait for some certain events to occur that will eventually occur anyway.
Now some people might not like how long it takes; maybe it's waiting for some unnecessary events that are not relevant to this file.
- Joker_vD 3y agoSurely fsync() should at least initiate syncing the data to the disk? Otherwise, everything FS-related could theoretically still fit in the memory cache forever, and so fsync() will never return.
- nh2 3y agoNo. If you don't call fsync(), there's no guarantee that your data will _ever_ be written to disk. Some file systems with some settings may write data to hardware after some delay or periodically, but others may not. fsync() "performs" e.g. an ATA FLUSH command on the underlying hardware.