Erase Block Summary
   HOME

TheInfoList



OR:

Journalling Flash File System version 2 or JFFS2 is a
log-structured file system A log-structured filesystem is a file system in which data and metadata are written sequentially to a circular buffer, called a log. The design was first proposed in 1988 by John K. Ousterhout and Fred Douglis and first implemented in 1992 by ...
for use with flash memory devices. It is the successor to
JFFS The Journaling Flash File System (or JFFS) is a log-structured file system for use on NOR flash memory devices on the Linux operating system. It has been superseded by JFFS2. Design Flash memory (specifically NOR flash) must be erased pri ...
. JFFS2 has been included into the Linux kernel since September 23, 2001, when it was merged into the
Linux kernel mainline The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU o ...
as part of the kernel version 2.4.10 release. JFFS2 is also available for a few
bootloader A bootloader, also spelled as boot loader or called boot manager and bootstrap loader, is a computer program that is responsible for booting a computer. When a computer is turned off, its softwareincluding operating systems, application code, an ...
s, like
Das U-Boot Das U-Boot (subtitled "the Universal Boot Loader" and often shortened to U-Boot; see ''History'' for more about the name) is an open-source, primary boot loader used in embedded devices to package the instructions to boot the device's operating ...
,
Open Firmware Open Firmware is a standard defining the interfaces of a computer firmware system, formerly endorsed by the Institute of Electrical and Electronics Engineers (IEEE). It originated at Sun Microsystems, where it was known as OpenBoot, and has bee ...
, the
eCos The Embedded Configurable Operating System (eCos) is a free and open-source real-time operating system intended for embedded systems and applications which need only one process with multiple threads. It is designed to be customizable to prec ...
RTOS, the
RTEMS Real-Time Executive for Multiprocessor Systems (RTEMS), formerly Real-Time Executive for Missile Systems, and then Real-Time Executive for Military Systems, is a real-time operating system (RTOS) designed for embedded systems. It is free and open ...
RTOS, and the
RedBoot RedBoot (an acronym for Red Hat Embedded Debug and Bootstrap firmware) is an open-source application that uses the eCos real-time operating system Hardware Abstraction Layer to provide bootstrap firmware for embedded systems. RedBoot allows d ...
. Most prominent usage of the JFFS2 comes from
OpenWrt OpenWrt (from ''open wireless router'') is an open-source project for embedded operating systems based on Linux, primarily used on embedded devices to route network traffic. The main components are Linux, util-linux, musl, and BusyBox. All ...
. At least three file systems have been developed as JFFS2 replacements: LogFS,
UBIFS UBIFS (UBI File System, more fully Unsorted Block Image File System) is a flash file system for unmanaged flash memory devices. UBIFS works on top of an UBI (unsorted block image) layer, which is itself on top of a memory technology device ( ...
, and
YAFFS Yaffs (Yet Another Flash File System) is a file system designed and written by Charles Manning for the company Aleph One. Yaffs1 was the first version of this file system and was designed for the then-current NAND chips with 512 byte page size ( ...
.


Features

JFFS2 introduced: * Support for
NAND flash Flash memory is an electronic non-volatile computer memory storage medium that can be electrically erased and reprogrammed. The two main types of flash memory, NOR flash and NAND flash, are named for the NOR and NAND logic gates. Both use ...
devices. This involved a considerable amount of work as NAND devices have a sequential I/O interface and cannot be memory-mapped for reading. * Hard links. This was not possible in JFFS because of limitations in the on-disk format. * Compression. Four algorithms are available:
zlib zlib ( or "zeta-lib", ) is a software library used for data compression. zlib was written by Jean-loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compression program. zlib is also ...
, rubin, rtime, and lzo. * Better performance. JFFS treated the disk as a purely circular log. This generated a great deal of unnecessary I/O. The
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
in JFFS2 makes this mostly unnecessary.


Design

As with JFFS, changes to files and directories are "logged" to flash in ''nodes'', of which there are two types: * '' inodes'': a header with file metadata, followed by a payload of file data (if any). Compressed payloads are limited to one page. * ''dirent'' nodes: directory entries each holding a name and an inode number. Hard links are represented as different names with the same inode number. The special inode number 0 represents an unlink. As with JFFS, nodes start out as ''valid'' when they are created, and become ''obsolete'' when a newer version has been created elsewhere. Unlike JFFS, however, there is no circular log. Instead, JFFS2 deals in ''blocks'', a unit the same size as the erase segment of the flash medium. Blocks are filled, one at a time, with nodes from bottom up. A ''clean'' block is one that contains only ''valid'' nodes. A ''dirty'' block contains at least one ''obsolete'' node. A ''free'' block contains no nodes. The garbage collector runs in the background, turning ''dirty'' blocks into ''free'' blocks. It does this by copying ''valid'' nodes to a new block and skipping ''obsolete'' ones. That done, it erases the ''dirty'' block and tags it with a special marker designating it as a ''free'' block (to prevent confusion if power is lost during an erase operation). To make wear-levelling more even and prevent erasures from being too concentrated on mostly-static file systems, the garbage collector will occasionally also consume ''clean'' blocks.


Disadvantages

Due to its log-structured design, JFFS2's disadvantages include the following: * All nodes must still be scanned at mount time. This is slow and is becoming an increasingly serious problem as flash devices scale upward into the
terabyte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable uni ...
range. To overcome this issue, the ''Erase Block Summary'' (EBS) was introduced in version 2.6.15 of the Linux kernel. EBS is placed at the end of each block and updated upon each write to the block, summarizing the block's content; during mounts, EBS is read instead of scanning whole blocks. * Writing many small blocks of data can even lead to negative compression rates, so it is essential for applications to use large write buffers. * There is no practical way to tell how much usable free space is left on a device since this depends both on how well additional data can be compressed, and the writing sequence.


See also

*
List of file systems The following lists identify, characterize, and link to more thorough information on Computer file systems. Many older operating systems support only their one "native" file system, which does not bear any name apart from the name of the operating ...
*
ZFS ZFS (previously: Zettabyte File System) is a file system with volume management capabilities. It began as part of the Sun Microsystems Solaris operating system in 2001. Large parts of Solaris – including ZFS – were published under an ope ...
*
Btrfs Btrfs (pronounced as "better F S", "butter F S", "b-tree F S", or simply by spelling it out) is a computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager (not to be confused ...
*
NILFS NILFS or NILFS2 (''New Implementation of a Log-structured File System'') is a log-structured file system implementation for the Linux kernel. It was developed by Nippon Telegraph and Telephone Corporation (NTT) CyberSpace Laboratories and a comm ...
*
F2FS F2FS (Flash-Friendly File System) is a flash file system initially developed by Samsung Electronics for the Linux kernel. The motive for F2FS was to build a file system that, from the start, takes into account the characteristics of NAND flash ...


External links


JFFS2 websiteJFFS: The Journalling Flash File System
by David Woodhouse
PDF

JFFS2 official mailing list


References

{{Filesystem, state=collapsed Disk file systems Embedded Linux Flash file systems supported by the Linux kernel Compression file systems Computer-related introductions in 2001