2024-12-28 EXT3 How does it work

Outline

talk about changes:

Explored in more detail: EXT234

EXT2 Released in 1993 with Linux 0.99

EXT3 Released in 2001 with Linux 2.4.15

talk about old hardware and simplicity

Journal

can be applied to multiple partition

helps with:

not losing data in crash

faster recovery in case of crash

solve the orphaned file problem (phantom inode)

Htrees

Relegated to its own vid

Improving scalability

in 2001 there was not a lot of multicore CPU and was non existent from the consumer market

but the writing was on the wall that we needed to optimize parallel load

there is 3 main way they did it:

  1. they stopped updating the superblock s_inodes_count and S_blocks_count, only updating the block group descriptor
  2. Replaced Big Kernel Lock (BKL) by smaller lock in Journal code.
  3. removed sleep_on() by wait_event(). sleep_on() was unsafe, most implementation looked like this:

while (we_have_to_wait)

sleep_on(some_wait_queue);

10x perf boost

Reservation based block allocator

Preallocation (Old) used the block bitmap by preallocating block and correcting with full check in case of crash

Reservation (New) is a process 100% done in memory instead of in disk.

You have a reservation window which is 8 block long (unless specified in IOCTL command)

Online resizing

The availability of a Logical Volume Manager (LVM), motivated the desire for on-line resizing.

Here are the 3 part of growing:

  1. Expand the last partial block group (if any) to be a full block group.
  2. Add new entry in Group descriptor table and fill group. up to 16GB increment for 4k block size
  3. Add a new block to the group descriptor table and add a new group to that block (Need to patch the FS before mounting)

Fast review of the schematic changes

superblock:

has some entry to know which feature is compatible or not

special inode:

has a special inode #8 for journal

directory:

that was there since 2nd version of ext2, we have the file type