Skip to content

image/machine: ext4 without orphan_file, inode tables zeroed at build, rootfstype=ext4 - #286

Merged
aledbf merged 3 commits into
mainfrom
ext4-mount
Nov 19, 2026
Merged

aledbf merged 3 commits into
mainfrom
ext4-mount

Conversation

@aledbf

@aledbf aledbf commented Nov 19, 2026

Copy link
Copy Markdown
Member

Three cuts to the root mount, from a source-level read of Linux 7.3 and the image. The kernel's gap from the last initcall to "EXT4-fs (vda): mounted" is 6.8 ms nested, 5.0 metal.

  • No orphan_file. ext4_init_orphan_info() read 73 blocks one at a time at every mount, a virtio round trip each. Crash handling falls back to the classic orphan list and the journal.
  • Inode tables zeroed at build (lazy_itable_init=0). mke2fs -d marked no group ITABLE_ZEROED, so every VM's ext4lazyinit wrote 16 MiB of zeroes into its own overlay about a second after boot, in the login's window. After one boot that overlay held 16.06 MiB of zero clusters; it now holds 0. The image costs nothing for it (−256 KiB), because qcow2 does not allocate zero clusters. The thread still starts, but only to prefetch bitmaps, which only reads.
  • rootfstype=ext4. The root mount tried ext3 and ext2 first, re-reading the superblock each time.

image/build.sh asserts the outcome on the finished filesystem:

  • it fails if orphan_file is present;
  • the groups marked ITABLE_ZEROED must equal the group count computed from the header, so empty output fails too. Both checks were also run against images built to fail them.

Checked:

  • boot:lockdown, boot:logind, boot:hotadd, task lint and go test ./... pass.
  • Laptop lead, at load ~30: the mount gap went 2.8-8.8 → 1.2-2.4 ms. It is a lead only.

The bench measures the image once it is in a release (boot:ssh-first, boot:restore-first), because the lab boots published images.

🤖 Generated with Claude Code

aledbf and others added 3 commits November 19, 2026 13:36
Without it the root mount walks the registered block filesystems, and ext4's
init registers ext3 and ext2 (EXT4_USE_FOR_EXT2) ahead of ext4: two refused
mounts, each a superblock read after a block size change, before the one that
works. The root is the image's ext4, or an overlay of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
orphan_file costs every mount, read-only included, ~73 sequential
single-block reads in ext4_init_orphan_info, each a virtio round trip inside
the root mount; it only scales concurrent unlinks of open files. Crash
correctness is the classic orphan list's, as before 1.47.

lazy_itable_init=0 marks every group ITABLE_ZEROED: mke2fs -d left them all
unmarked, and each overlay's first read-write mount had ext4lazyinit write
16 MiB of zeroes into it within the first second of the boot. Measured with
one --init /bin/sh boot (laptop): 16.06 MiB of zero clusters in the overlay
before, none after. The image is 256 KiB smaller.

Both are read back from the finished filesystem: no orphan_file in dumpe2fs's
features, and ITABLE_ZEROED on as many groups as the header says there are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aledbf
aledbf merged commit d30f813 into main Nov 19, 2026
3 checks passed
@aledbf
aledbf deleted the ext4-mount branch November 19, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant