Soft updates
Soft updates is a filesystem metadata-consistency mechanism that delays unsafe on-disk changes until their update dependencies are satisfied.
The original BSD implementation uses per-change tracking and temporary buffer rollback rather than a full metadata journal. [1] FreeBSD also offers soft updates journaling as a separate setting. [3]
In the 4.4BSD implementation, aggregating operations that were previously done one at a time and synchronously cut disk writes by 40 to 70% in file-intensive workloads, with performance within a few percent of optimal. Once per second the syncer daemon processes the task list of dependency work that has become safe. [1]
Deferred removal has visible side effects. Correct ordering of a removed directory's '..' entry introduced a delay of up to two minutes before deallocation, so an in-memory effective link count was added for calls such as rmdir. A crash during bulk tree removal can leave tens to hundreds of unreferenced inodes, which fsck clears instead of moving them to lost+found. [1]
The FreeBSD 14.3 manual describes journal-based crash cleanup as usually taking seconds and no more than a minute, at the cost of extra log writes. That statement concerns journal recovery, not a bound on total service restoration or a full filesystem check. The manual separately calls for full checks periodically or after a filesystem panic because journal recovery cannot fix unrecorded media errors. [3]
Relations
- related
- Metadata update dependency, Background fsck, Crash consistency, Patchgroup, Backpointer-based consistency, SquirrelFS
Advantages
- The filesystem can be used immediately after a crash, and leftover unclaimed blocks and inodes are reclaimed later in the background. [1]
Limitations
- It does not make every recent application write durable, and unused allocations can require later reclamation. [1]
- Dependency structures consume kernel memory, so the implementation has to bound their total size. [1]
Citations
- McKusick and Ganger. Soft Updates: A Technique for Eliminating Most Synchronous Writes in the Fast Filesystem. FREENIX 1999, pp. 1-17, sections 2-4.
- FreeBSD 14.3-RELEASE tunefs(8): distinct soft updates and soft updates journaling settings.
Further reading
Sources & caveats
- soft1999 is the FREENIX 1999 paper by McKusick and Ganger, reread on the access date in the abstract, section 3 and the parts on fsync, link counts, memory use and fsck.
- tunefs143 is the FreeBSD 14.3-RELEASE tunefs(8) page, read in the -j and -n options.
- Historical quantities retain their original source scope. The tunefs143 journal-recovery time statement is not presented as an end-to-end recovery guarantee.