On 19 Apr 2020, at 18:40, Matt Neuburg wrote:
I’m not sure I believe that. Safe save is in fact one
of the boasts
of APFS. You ask for safe save, which causes the file system to clone
the file and now you get copy-on-write automatically, which is far
more efficient because only the changed blocks actually need to be
written. When you’re done saving, the original is atomically swapped
with the clone. m.
Before APFS we had `exchangedata` which atomically swaps the data part
of two files. Majority of applications derive no advantage from first
cloning the file to be updated, they simply write out a new file and
then swap it with the old one. In-place/partial update of a file during
save is for applications where the file may be too big to hold in
memory, like a disk image or a database backend, but require a specially
crafted file format to support this.
After APFS we have to use `rename` for atomically overwriting the old
file, but that has the disadvantages I listed in my email.
What you may have seen regarding atomic save and APFS is that Apple
extended rename to also allow atomic renaming of directories even when
the destination exist. This allows atomic save of bundles, which
previously was not possible. But it is unrelated to my grief about APFS
dropping support for `exchangedata`.