JFFS
From Wikipedia, the free encyclopedia
The Journalling Flash File System (or JFFS) is a log-structured file system for use on NOR flash memory devices. It has been superseded by JFFS2.
Contents |
[edit] Design
Flash memory has access constraints very unlike those of magnetic disks. In particular, erasing flash memory:
- Is necessary before writing
- Is slow
- Must be done in large (usually 64 KiB or more) segments
- Can only be done a certain number of times (typically less than a million)
File systems like ext2 typically update their data structures in-place, with data structures like inodes and directories updated on-disk after every modification. This concentrated lack of wear-levelling makes conventional file systems unsuitable for read-write use on flash devices.
JFFS enforces wear levelling by treating the flash device as a circular log. All changes to files and directories is written to the head of the log in nodes. In each node, a header containing metadata is written first, followed by file data, if any. Nodes are chained together with offset pointers in the header. Nodes start out as valid and then become obsolete when a newer version of them is created.
The free space remaining in the file system is the gap between the log's tail and its head. When this runs low, a garbage collector copies valid nodes from the head to the tail and skips obsolete ones, thus reclaiming space.
[edit] Disadvantages
- At mount time, the file system driver must read the entire inode chain and then keep it in memory. This can be very slow. Memory consumption of JFFS is also proportional to the number of files in the file system.
- The circular log design means all data in the filesystem is re-written, regardless of whether it is static or not. This generates many unnecessary erase cycles and reduces the life of the flash medium.
[edit] See also
[edit] References
- Woodhouse, David. JFFS: The Journalling Flash File System.