3 ms·
A filesystem-level transaction would be a good idea. Maybe some FSes (e.g. ZFS) already support such a thing. You can get this (somewhat awkwardly) for a sing
by colanderman 9y ago
A filesystem-level transaction would be a good idea. Maybe some FSes (e.g. ZFS) already support such a thing. You can get this (somewhat awkwardly) for a single file with any FS that supports copy-on-write by making a (lazy) copy of the file, doing your updates there, and then renaming it to the original file name (which is guaranteed to be atomic on most FSes). With smaller files this is standard practice even on FSes without copy-on-write.
> most block devices support read & write barriers
No, they really don't. Some hardware devices might. I'm not aware of any SAN that does. (I've specifically asked this question of the developers of three.)
> Filesystems lean heavily on these primitives for correctness
In Linux, not since 2010 they don't [1], for exactly the reason that they're poorly implemented by devices.
[1] https://lwn.net/Articles/400541/ https://lwn.net/Articles/400541/