ArticleslgStudy

science

YAFFS

YAFFS is a 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 YAFFS rather than just read about it. In short: 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 (+ 16 byte spare (OOB; Out-Of-Band) area).

Key takeaways

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

Reference excerpt

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 (+ 16 byte spare (OOB; Out-Of-Band) area). Work started in 2002, and it was first released later that year. The initial work was sponsored by Toby Churchill Ltd, and Brightstar Engineering. YAFFS is a robust log-structured file system that holds data integrity as a high priority. A secondary YAFFS goal is high performance. YAFFS will typically outperform most alternatives. It is also designed to be portable and has been used on Linux, Android, WinCE, pSOS, RTEMS, eCos, ThreadX, and various special-purpose OSes. A variant 'YAFFS/Direct' is used in situations where there is no OS, embedded OSes or bootloaders: it has the same core filesystem but simpler interfacing to both the higher and lower level code and the NAND flash hardware. The YAFFS codebase is licensed both under the GPL and under per-product licenses available from Aleph One. YAFFS is locked on a per-partition basis at a high level, allowing only one thread to write at any given time.

YAFFS1 There is no special procedure to initialize a YAFFS filesystem beyond simply erasing the flash memory. When a bad block is encountered, YAFFS follows the smart media scheme of marking the fifth byte of the block's spare area. Blocks marked as such remain unallocated from then on. To write file data, YAFFS initially writes a whole page (chunk in YAFFS terminology) that describes the file metadata, such as timestamps, name, path, etc. The new file is assigned a unique object ID number; every data chunk within the file will contain this unique object ID within the spare area. YAFFS maintains a tree structure in RAM of the physical location of these chunks. When a chunk is no longer valid (the file is deleted, or parts of the file are overwritten), YAFFS marks a particular byte in the spare area of the chunk as 'dirty'. When an entire block (32 pages) is marked as dirty, YAFFS can erase the block and reclaim the space. When the filesystem's free space is low, YAFFS consolidates a group of good pages onto a new block. YAFFS then reclaims the space used by dirty pages within each of the original blocks. When a YAFFS system mounts a NAND flash device, it must visit each block to check for valid data by scanning its spare area. With this information it then reconstitutes the memory-resident tree data structure.

YAFFS2 YAFFS2 is similar in concept to YAFFS1, and shares much of the same code; the YAFFS2 code base supports YAFFS1 data formats through backward compatibility. The main difference is that YAFFS2 needs to jump through significant hoops to meet the "write once" requirement of modern NAND flash. YAFFS2 marks every newly written block with a sequence number that is monotonically increasing. The sequence of the chunks can be inferred from the block sequence number and the chunk offset within the block. Thereby when YAFFS2 scans the flash and detects multiple chunks that have identical ObjectIDs and ChunkNumbers, it can choose which to use by taking the greatest sequence number. For efficiency reasons YAFFS2 also introduces the concept of shrink headers. For example, when a file is resized to a smaller size, YAFFS1 will mark all of the affected chunks as dirty – YAFFS2 cannot do this due to the "write once" rule. YAFFS2 instead writes a "shrink header", which indicates that a certain number of pages before that point are invalid. This lets YAFFS2 reconstruct the final state of the filesystem when the system reboots. YAFFS2 uses a more abstract definition of the NAND flash allowing it to be used with a wider variety of flash parts with different geometries, bad block handling rules etc. YAFFS2 later added support for checkpointing, which bypasses normal mount scanning, allowing very fast mount times. Performance will vary, but mount times of 3 seconds for 2 GB have been reported.

See also

List of file systems JFFS JFFS2 UBIFS LogFS NILFS, a New Implementation of a Log-structured File System Open NAND Flash Interface Working Group

References

http://www.yaffs.net/yaffs-history

External links Official website Introducing YAFFS, the first NAND-specific flash file system Unyaffs: A simple program to unpack YAFFS2 images. yaffs2utils: Utilities to create/extract a YAFFS2 image on Linux.

Worked examples

Example 1 — a first encounter with YAFFS

Start with the simplest possible case. Write down what YAFFS claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 YAFFS 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 YAFFS 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 YAFFS

In research
YAFFS appears in 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 YAFFS 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
YAFFS is common in secondary-school and first-year university syllabi. It links to neighbouring topics Embedded Linux, Flash file systems supported by the Linux kernel, Windows CE, so understanding it makes those chapters shorter.
In everyday life
Look for YAFFS 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.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “YAFFS” →

Affiliate

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

How to study YAFFS in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what YAFFS 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 YAFFS out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is YAFFS in simple terms?

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 (+ 16 byte spare (OOB; Out-Of-Band) area).

Why does YAFFS matter?

Because it connects several 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 YAFFS?

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 YAFFS.

Tags

  • Embedded Linux
  • Flash file systems supported by the Linux kernel
  • Windows CE
  • Yet another

Keep exploring