Yaffs
Yaffs
YAFFS
A NAND flash filesystem
Wookey
wookey@wookware.org
Aleph One Ltd
Balloonboard.org
1 Project Genesis
2 Flash hardware
3 YAFFS fundamentals
4 Filesystem Details
5 Embedded Use
Project Genesis Flash hardware YAFFS fundamentals Filesystem Details Embedded Use
Project Genesis
History
NAND reliabilty
NAND is unreliable - bad blocks, data errors
Affected by temp, storage time, manufacturing, voltage
Program/erase failure
Detected in hardware. YAFFS copies data and retires block
Charge Leakage - bitrot over time
ECC - Error Correction Codes
Write disturb: (extra bits set to 0 in page/block)
YAFFS2 minimises write disturb (sequential block writes, no
re-writing)
Read disturb, other pages in block energised.
minor effect - needs 10*endurance reads to give errors
ECC (not sufficient)
count page reads, rewriting block at threshold
Read other pages periodically (e.g. every 256 reads)
MLC makes all this worse - multiple program and read voltages
Project Genesis Flash hardware YAFFS fundamentals Filesystem Details Embedded Use
Design approach
Terminology
Flash-defined
Page - 2k flash page (512 byte YAFFS1)
Block - Erasable set of pages (typically 64 on 2K NAND)
YAFFS-defined
Chunk - YAFFS tracking unit.
usually==page.
Can be bigger, e.g. 2x2K NAND in parallel as 4K chunks)
Project Genesis Flash hardware YAFFS fundamentals Filesystem Details Embedded Use
Process
Next we close the file. This writes a new object header for the
file. Notice how the previous object header is deleted.
Flash Blocks
Block Chunk ObjId ChunkId DelFlag Comment
0 0 500 0 Del Obsoleted object header (length 0)
Let’s now open the file for read/write, overwrite part of the first
chunk in the file and close the file. The replaced data and
object header chunks become deleted.
Flash Blocks
Block Chunk ObjId ChunkId DelFlag Comment
0 0 500 0 Del Obsoleted object header (length 0)
0 1 500 1 Del Obsoleted first chunk of data
YAFFS2
Filesystem Limits
YAFFS1
218 files (>260,000)
220 max file size (512MB)
1GB max filesystem size
OOB data
YAFFS1:
Derived from Smartmedia, (e.g byte 5 is bad block marker)
16 bytes: 7 tags, 2 status, 6 ECC
YAFFS/Smartmedia or JFFS2 format ECC
YAFFS2:
64 bytes available in 2k page
MTD-determined layout (on linux)
MTD or hardware does ECC - 38 bytes free on 2.6.21
Tags normally 28 bytes (16 data, 12ecc)
Sometimes doesn’t fit (eg oneNAND - 20 free)
Project Genesis Flash hardware YAFFS fundamentals Filesystem Details Embedded Use
RAM usage
Level0-Tnodes:
Chunksize RAM use/MB NAND 256MB NAND
512b 4K 1MB
2k 1K 256K
4k 0.5K 128K
Can change chunk size, and/or parallel chips.
Higher-level Tnodes: 0-Tnodes/8, etc
Objects: 24bytes (+17 with short name caching) per file
For 256MB 2K chunk NAND with 3000 files/dirs/devices
128k chunks needs 18bits per Tnode cell, so
Level 0-Tnodes: 288K
Level 1-Tnodes: 36K
Level 2-Tnodes: 5K
Objects: 120K
449K total
Project Genesis Flash hardware YAFFS fundamentals Filesystem Details Embedded Use
Partitioning
Checkpointing
Caching
ECC
OS portability
Native
Linux
WinCE
NetBSD
Yaffs Direct Interface
pSOS
ThreadX
DSP_BIOS
Others
Bootloaders - simple read-only YAFFS
Project Genesis Flash hardware YAFFS fundamentals Filesystem Details Embedded Use
YAFFS in use
YAFFS Architecture
Application
POSIX Interface
YAFFS Direct Interface
YAFFS Core
Filesystem
RTOS Flash
Interface Interface
RTOS Flash
Project Genesis Flash hardware YAFFS fundamentals Filesystem Details Embedded Use
Licensing
Future Developments
The end
http://yaffs.net
Questions?