Soft updates
From Wikipedia, the free encyclopedia
In computer file systems, soft updates are an approach to maintaining disk integrity after a crash or power outage. They are an alternative to journaling file systems.
Instead of duplicating metadata writes in a journal, soft updates work by properly ordering the metadata writes to guarantee consistency after a crash. Like journaling, soft updates do not guarantee that no data will be lost, but do make sure the filesystem is consistent.
An advantage of a file system with soft updates is that it can be mounted almost instantaneously.
Soft updates were first introduced to FreeBSD by Marshall Kirk McKusick and are now available across the BSDs.
[edit] Operation
Soft updates allow only asynchronous metadata writes that do not render the on-disk file system inconsistent, or that the only inconsistency that ever happens is a storage leak. It avoids having to do ordered synchronous meta-data writes by temporarily "rolling back" any part of a meta-data block that depends on another potentially non-flushed or partially rolled back block when writing it. In effect, blocks may be flushed at any time, and the soft-update code will always provide the disk a consistent version of it (as long as it knows which blocks have physically been flushed at this time). Recovery then simply becomes a matter of running a background walk of the file system when it is next mounted to garbage collect any data orphaned in leaks. This also permits the filesystem to selectively flush certain files without having to flush all meta-data blocks or a whole journal. Also, data that is unlinked from the meta-data dependency graph before writing it to disk has begun does not need to be written to disk at all. For example, creating a file, using it for a short period of time, and then deleting it may cause no disk activity at all. However, some disadvantages of soft updates are that it is very complex to implement correctly, that it still causes a lot of scattered meta-data writes that have to be forced to disk periodically to make sure that the on-disk FS version does not lag behind the in-core one too much, and that these scattered writes may be more likely to trigger inconsistencies when the disk flushes its internal write cache in arbitrary order.
[edit] References
- McKusick, M. (2002). Running "fsck" in the Background." Proceedings of the BSDCon 2002. 55-64.
- McKusick, M. and Ganger, G. (1999). "Soft Updates: A Technique for Eliminating Most Synchronous Writes in the Fast Filesystem." USENIX Annual Technical Conference. 1-18.
- Seltzer, M. et al. (2000). "Journaling Versus Soft Updates: Asynchronous Meta-data Protection in File Systems." USENIX Annual Technical Conference. 71-84.

