Soft Updates increases file system efficiency by ordering the disk writes so that every write creates a consistent state.
This allows all writes to happen asynchronously and to avoid seeks wherever possible.
On a typical file system there are files, directories and pointers to these. A directory inode points to the direcotry data which points to either more directory nodes or to file inodes. The file inodes point to the file data.
If this chain is broken somewhere in between, for example if the directory points to inodes not (yet) written and the system crashes, it is in an inconsistent state.
Soft Updates' Solution to this is ordering the meta-data writes to disk to avoid such inconsistencies.
To order these writes, the system needs to track which blocks need to be written to disk before others.
Please consider the example that one file is created an another is deleted, both in the same directory. (if you have problems imagining this, please refer to the fourth paper, page 8, or click on this link, while it lasts).
If dependency information is stored regarding only blocks, the directory block needs to be written before the inode block and vice versa.
To solve this, the system remembers dependency information for every single piece of data, either file or directory.
Still, in the state from the example, you can not write either block while guaranteeing consistency.
The solution to this is called roll-back:
One of the blocks is modified to a state that never existed and then written to disk. This extra write produces a sequences of consistent states
As a result, whenever a crash occurs, the whole file system is in a consistent state in that no references point to some unused space.
There might be allocated blocks inside the system (mostly data) that are not used anywhere.
These can be found by doing a check in the background.
The speed increase in Soft Updates results from writing all of the meta-data operations asynchronously. In contrast with Journaling, no log is written to disk, producing no extra overhead. The only extra writes that occur are the roll-back writes and those resulting when the current state does not fit to memory any more.
In tests in the literature, SoftUpdates results in a speed increase of 30 to 660 %.
- Journaling versus Soft Updates: Asynchronous Meta-data Protection in File Systems
- Embedded Inodes and Explicit Grouping: Exploiting Disk Bandwidth for Small files
- Reimplementing the Cedar File System Using Logging and Group Commit
- Soft Updates: A Solution to the Metadata Update Problem in File Systems