Skip to main content

H 10 Journaling File System

This page is a generated reference surface for selective reading. It exists to keep the learner apps guide-first while still preserving source access.

Learning objectives

  • Explain the main ideas and vocabulary in H 10 Journaling File System.
  • Work through the source examples for H 10 Journaling File System without depending on raw chunk order.
  • Use H 10 Journaling File System as selective reference when learner modules point back to Ostep.

Prerequisites

  • None curated yet.

Module targets

  • module-04-file-systems-io

AI companion modes

  • Explain simply
  • Socratic tutor
  • Quiz me
  • Challenge my understanding
  • Diagnose my confusion
  • Generate extra practice
  • Revision mode
  • Connect forward / backward

Source-of-truth note

This unit is anchored to Ostep and the source chapter "H 10 Journaling File System". Use external resources only to clarify, extend, or modernize details without replacing the chapter's conceptual spine.

External enrichment

No chapter-specific enrichment resources are curated yet. Add them in the unit manifest when a source clearly improves learning.

Source provenance

  • Primary source: Ostep
  • Source chapter: H 10 Journaling File System
  • Raw source file: 265-h-10-journaling-file-system.md

Merged source

H 10 Journaling File System

H.10 Journaling File System

Students add a rudimentary journaling layer to xv6. For each write to a file, the journaling FS batches up all dirtied blocks and writes a record of their pending update to an on-disk log; only then are the blocks modified in place. Students demonstrate the correctness of their system by introducing crash points and showing that the file system always recovers to a consistent state.

H.11 File System Checker

Students build a simple file system checker for the xv6 file system.

Students learn about what makes a file system consistent and how exactly to check for it.

I

Flash-based SSDs

After decades of hard-disk drive dominance, a new form of persistent storage device has recently gained significance in the world. Generically referred to as solid-state storage, such devices have no mechanical or moving parts like hard drives; rather, they are simply built out of transistors, much like memory and processors. However, unlike typical random-access memory (e.g., DRAM), such asolid-state storage device (a.k.a., an SSD) retains information despite power loss, and thus is an ideal candidate for use in persistent storage of data.

The technology we'll focus on is known as flash (more specifically,

NAND-based flash), which was created by Fujio Masuoka in the 1980s

[M+14]. Flash, as we'll see, has some unique properties. For example, to write to a given chunk of it (i.e., aflash page), you first have to erase a bigger chunk (i.e., aflash block), which can be quite expensive. In addition, writing too often to a page will cause it towear out. These two properties make construction of a flash-based SSD an interesting challenge:

CRUX: HOWTOBUILDA FLASH-BASEDSSD

How can we build a flash-based SSD? How can we handle the expensive nature of erasing? How can we build a device that lasts a long time, given that repeated overwrite will wear the device out? Will the march of progress in technology ever cease? Or cease to amaze?

I.1 Storing a Single Bit

Flash chips are designed to store one or more bits in a single transistor; the level of charge trapped within the transistor is mapped to a binary value. In asingle-level cell(SLC) flash, only a single bit is stored within a transistor (i.e., 1 or 0); with amulti-level cell(MLC) flash, two bits are encoded into different levels of charge, e.g., 00, 01, 10, and 11 are represented by low, somewhat low, somewhat high, and high levels. There is eventriple-level cell(TLC) flash, which encodes 3 bits per cell. Overall,

SLC chips achieve higher performance and are more expensive.

1

TIP: BECAREFULWITHTERMINOLOGY

You may have noticed that some terms we have used many times before (blocks, pages) are being used within the context of a flash, but in slightly different ways than before. New terms are not created to make your life harder (although they may be doing just that), but arise because there is no central authority where terminology decisions are made. What is a block to you may be a page to someone else, and vice versa, depending on the context. Your job is simple: to know the appropriate terms within each domain, and use them such that people well-versed in the discipline can understand what you are talking about. It's one of those times where the only solution is simple but sometimes painful: use your memory.

Of course, there are many details as to exactly how such bit-level storage operates, down at the level of device physics. While beyond the scope of this book, you can read more about it on your own [J10].

I.2 From Bits to Banks/Planes

As they say in ancient Greece, storing a single bit (or a few) does not a storage system make. Hence, flash chips are organized intobanksor planeswhich consist of a large number of cells.

A bank is accessed in two different sized units: blocks(sometimes callederase blocks), which are typically of size 128 KB or 256 KB, and pages, which are a few KB in size (e.g., 4KB). Within each bank there are a large number of blocks; within each block, there are a large number of pages. When thinking about flash, you must remember this new terminology, which is different than the blocks we refer to in disks and RAIDs and the pages we refer to in virtual memory.

Figure I.1 shows an example of a flash plane with blocks and pages; there are three blocks, each containing four pages, in this simple example. We'll see below why we distinguish between blocks and pages; it turns out this distinction is critical for flash operations such as reading and writing, and even more so for the overall performance of the device.

The most important (and weird) thing you will learn is that to write to a page within a block, you first have to erase the entire block; this tricky detail makes building a flash-based SSD an interesting and worthwhile challenge, and the subject of the second-half of the chapter.

Block: 0 1 2

Page: 00 01 02 03 04 05 06 07 08 09 10 11

Content:

Figure I.1:A Simple Flash Chip: Pages Within Blocks