This article relies too much on references to primary sources. (February 2013) (Learn how and when to remove this template message)
|Developer(s)||Jörn Engel, Prasad Joshi|
|Supported operating systems||Linux|
LogFS was introduced in the mainline Linux kernel in version 2.6.34, released on May 16, 2010. It was removed from the codebase during the merge window of version 4.10, in December 2016, because it was "unmaintained for years and seemingly unused".
As of November 2008[update], LogFS was mature enough to pass its entire test suite, and was subsequently included in the mainline Linux kernel, marked as 'experimental', in version 2.6.34 released on May 16, 2010. However, it did not attract a large user base and was removed from the kernel in December 2016.
LogFS was motivated by the difficulties of JFFS2 with larger flash-memory drives. LogFS stores the inode tree on the drive; JFFS2 does not, which requires it to scan the entire drive at mount and cache the entire tree in RAM. For larger drives, the scan can take dozens of seconds and the tree can take a significant amount of main memory. LogFS avoids these penalties, but it does do more work while the system is running and uses some of the drive's space for holding the inode tree.
LogFS stores a file's inode tree on the drive, which means on a write to the file, each ancestor node in the tree must be rewritten. This is done by a "wandering tree" update. The lowest node in the tree (i.e., the data) is written first, each node is written ascending the tree, until the root inode is updated. Writing the root last maintains atomicity of the update.
A flash-memory block is the unit for erasures and is usually larger than the file-system block. LogFS handles this disparity by packing multiple file-system blocks into a single flash-memory block. A "sum" entry at the end of the flash-memory block records what data is stored in it. When the flash-memory block has all its file-system blocks moved or deleted, it can be erased and used for new data.
For peak usage of the flash-memory drive, it is necessary to compact data so that flash-memory blocks are full of useful data. This is accomplished by garbage collection. LogFS's garbage collection strategy relies on file data being placed in a certain way into flash-memory blocks: a flash-memory block will hold only file data from the same level in the inode tree. LogFS can garbage collect the top level of the trees using just 1 empty flash-memory block. It can garbage collect the top 2 levels of the trees using 2 empty flash-memory blocks. And can garbage collect all N levels of the trees using N empty flash memory blocks. The algorithm is exponential time in the worst case, but the worst case is rare and the algorithm requires reserving only a handful of flash-memory blocks.
Logfs in Action
The latest logfs source is available from logfs git tree.