ArticleslgStudy

computer science

JFFS2

JFFS2 is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand JFFS2 rather than just read about it. In short: Journalling Flash File System version 2 or JFFS2 is a log-structured file system for use with flash memory devices. It is the successor to JFFS.

Key takeaways

  • JFFS2 belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect JFFS2 to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of JFFS2 from memory before moving on to harder problems.

Reference excerpt

Journalling Flash File System version 2 or JFFS2 is a log-structured file system for use with flash memory devices. It is the successor to JFFS. JFFS2 has been included into the Linux kernel since September 23, 2001, when it was merged into the Linux kernel mainline as part of the kernel version 2.4.10 release. JFFS2 is also available for a few bootloaders, like Das U-Boot, Open Firmware, the eCos RTOS, the RTEMS RTOS, and the RedBoot. Most prominent usage of the JFFS2 comes from OpenWrt. At least three file systems have been developed as JFFS2 replacements: LogFS, UBIFS, and YAFFS.

Features JFFS2 introduced:

Support for NAND flash 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. Five algorithms are available: zlib, rubin, lzma, 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 algorithm 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 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

References

External links JFFS2 website JFFS: The Journalling Flash File System by David Woodhouse (PDF) JFFS2 official mailing list JFFS2 FAQ

Worked examples

Example 1 — a first encounter with JFFS2

Start with the simplest possible case. Write down what JFFS2 claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to JFFS2 before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about JFFS2 ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of JFFS2

In research
JFFS2 appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses JFFS2 in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
JFFS2 is common in secondary-school and first-year university syllabi. It links to neighbouring topics Compression file systems, Computer-related introductions in 2001, Disk file systems, so understanding it makes those chapters shorter.
In everyday life
Look for JFFS2 outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study JFFS2 in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what JFFS2 means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain JFFS2 out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is JFFS2 in simple terms?

Journalling Flash File System version 2 or JFFS2 is a log-structured file system for use with flash memory devices. It is the successor to JFFS.

Why does JFFS2 matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study JFFS2?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on JFFS2.

Tags

  • Compression file systems
  • Computer-related introductions in 2001
  • Disk file systems
  • Embedded Linux
  • Flash file systems supported by the Linux kernel

Keep exploring