3 ms·
What you say is correct, and ext4's current default behaviour can be quite confusing: * ext4 turns rename() into an invisible fsync(), if the target file exist
by nh2 3y ago
What you say is correct, and ext4's current default behaviour can be quite confusing:
* ext4 turns rename() into an invisible fsync(), if the target file existed.
* ext4 turns close() into an invisible fsync(), if the opened file existed.
This leads to surprising results:
If you unzip something the first time, it's nice and fast.
If you unzip the same file again, force-overwriting existing files, suddenly it's 10x slower. You now spend hours finding out why, and start cargo-culting vodoo that doing `rm` before makes it inexplicably fast again.
Invisible fsync()s that the application programmer cannot turn off are quite bad.
My speculation is that Ted Ts'o agrees with that in principle, but that he got tired of having to explain people that if they don't fsync(), there are no guarantees; so he added this hack that makes 95% of the cases go away with surprising special-case behaviour.
- nh2 3y agoFor people who want to read more about this in _up-to-date_ documentation: * `auto_da_alloc` section of https://www.kernel.org/doc/html/latest/admin-guide/ext4.html https://www.kernel.org/doc/html/latest/admin-guide/ext4.html * https://en.wikipedia.org/wiki/Ext4#Delayed_allocation_and_potential_data_loss https://en.wikipedia.org/wiki/Ext4#Delayed_allocation_and_po...