Skip to content
← ENGINEERING NOTES
LINUX7 min read

ext4 Gets an Optional iomap Path in Linux 7.4

Linux 7.4 adds an opt-in iomap buffered I/O path to ext4. What buffered_iomap changes, what it cannot do yet, and how to benchmark it safely with fio.

BY ASHLIN DARIUS GOVINDASAMY

ext4 has been writing your files through the same plumbing since the days when 'buffer_head' sounded modern. Linux 7.4 finally ships an alternative: an optional iomap-based buffered I/O path, switched on with one mount option. It is off by default, it has sharp edges, and it is exactly the kind of change you should test on a scratch disk this week instead of discovering in production next year.

What changed in ext4 for Linux 7.4

Per Phoronix's coverage of the ext4 pull request for the 7.4 merge window, ext4 gained an optional buffered iomap code path. It is not enabled by default; you opt in with the buffered_iomap mount option. The work was led by Zhang Yi of Huawei, who has been posting versions of this series on the kernel mailing lists since at least 2024, and the mount-option patch is the last patch of the series.

Buffered I/O is the normal path for read() and write(): data goes through the page cache and the kernel writes it back later. Historically ext4 tracked the state of each block inside a page using struct buffer_head. iomap is the newer framework that filesystems like XFS use: instead of per-block bookkeeping, the filesystem tells the generic layer 'file range A to B maps to disk range X to Y' and the common code does the rest. One practical payoff is that the generic code works naturally with large folios, meaning the page cache can handle bigger chunks per operation than a single 4 KiB page.

How the buffered write path works, and why it matters

When your program calls write(), the kernel does not touch the disk. It finds or allocates cache memory for that file range, copies your bytes in, marks the memory dirty and returns. Later, writeback threads find the dirty ranges and ask the filesystem where on disk they belong. Two questions therefore matter for performance: how much work the filesystem does per chunk of cache, and how big the chunks are.

With buffer_heads, ext4 keeps a small descriptor for every block inside a cached page, so a 4 KiB page on a 4 KiB-block filesystem carries one descriptor, and a bigger chunk means more descriptors to allocate, track and walk. With iomap, the filesystem answers one mapping question per range, and the shared code tracks dirty and uptodate state itself. Fewer descriptors and bigger ranges are the ingredients you want for streaming workloads such as video ingest, database checkpoints, backups and the model weights you copy onto a GPU box.

If this sounds familiar, it should: dirty-page throttling and writeback are exactly the machinery we tuned in our post on vm.dirty_ratio. The new path does not replace those knobs. It changes how much work each dirty byte costs before it ever reaches them.

What it cannot do yet

The reason it is opt-in is that the new path does not implement every ext4 feature. Reports on the pull request list these as unsupported with buffered_iomap: online defragmentation, inline data, fs-verity, fscrypt, non-extent inodes and data=journal. ext4 can fall back to the original path when necessary, so a filesystem using those features should keep working, but it will not get the new behaviour.

  • Using fscrypt or fs-verity (common on Android-style setups)? You are on the old path for those files.
  • Mounted with data=journal? Old path. (If that rings a bell, we covered the journal-mode deprecation in an earlier post.)
  • Old filesystem without extents? Old path.
  • Plain data=ordered on a modern extent-based ext4? That is the target audience.

QUICK CHECK

Your server runs ext4 with data=journal. You mount it with buffered_iomap on a 7.4 kernel. What should you expect?

Set up a safe test rig

You need a 7.4 kernel (release candidates are fine for experiments; check our earlier post on testing an rc kernel) and a disposable block device. A real spare NVMe partition gives meaningful numbers. A loop device over a file works for checking that the option is accepted, but it adds another cache layer on the host, so do not trust its performance results.

bash
uname -r                      # expect 7.4-rcN or newer
truncate -s 8G /var/tmp/ext4-test.img
LOOP=$(sudo losetup --find --show /var/tmp/ext4-test.img)
sudo mkfs.ext4 -F "$LOOP"

# Baseline: the default (buffer_head) path
sudo mkdir -p /mnt/base
sudo mount "$LOOP" /mnt/base
findmnt /mnt/base
sudo umount /mnt/base

# Opt in to the iomap buffered I/O path
sudo mkdir -p /mnt/iomap
sudo mount -o buffered_iomap "$LOOP" /mnt/iomap
findmnt /mnt/iomap
dmesg | tail -n 5
Quick functional test on a loop device (numbers from this setup are not representative)

If your kernel is older than 7.4, the mount will fail with an unknown option error, which is itself a handy feature probe. If it mounts, run the same workload against both mounts using the same device, one at a time, and reboot or drop caches between runs.

Benchmark it with fio

Reporting on the merge says large writes got faster with the new path while 1 KiB writes followed by fsync were slower. That is a sensible pair of workloads to reproduce, because it covers both ends: streaming writes and small synchronous commits (think database WAL or a mail queue).

bash
run() {
  dir=$1
  sync; echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null

  echo "== large buffered writes: $dir"
  fio --name=big --directory="$dir" --rw=write --bs=1M --size=4G       --ioengine=psync --end_fsync=1 --group_reporting

  echo "== 1 KiB writes + fsync: $dir"
  fio --name=small --directory="$dir" --rw=write --bs=1k --size=64M       --ioengine=psync --fsync=1 --group_reporting
}

run /mnt/base      # mount WITHOUT buffered_iomap
# umount, remount with -o buffered_iomap, then:
run /mnt/iomap
Two workloads: big sequential writes, and tiny writes with fsync after each one

Compare bandwidth for the first job and IOPS plus latency percentiles for the second. Repeat each run at least three times and look at the spread, not just the best number. If the difference is smaller than your run-to-run noise, you have learned something too: for your workload it does not matter.

›Deep dive: why would small fsync writes get slower?

A tiny write followed by fsync spends most of its time on the journal commit and the device flush, not on moving data through the page cache. A new buffered path adds its own per-operation cost, such as mapping the range through the filesystem and managing folio state, and that cost is a larger fraction of a very short operation. For large writes the same per-operation cost is amortized over many bytes and the bigger-chunk handling wins. This is a plausible explanation consistent with the reported results, not a measurement we made, so always profile your own workload.

Gotchas and what to watch

  • Mount options are per filesystem, so you can trial it on one scratch volume while the rest of the box stays on the default.
  • Remount with a changed option may not be allowed; do a clean unmount and mount for A/B runs.
  • Run on the same device and the same free-space state for both arms; a fresh filesystem versus a half-full one will swamp the difference.
  • Keep an eye on dmesg and your kernel version: this series has gone through many revisions, and early kernels carry the highest bug risk.
  • Watch the stable and ext4 mailing lists for fixes before you change production.

QUICK CHECK

Which benchmark pair gives the most useful picture of the new path?

Takeaway

Linux 7.4 does not make ext4 faster by default; it gives you a switch. For write-heavy workloads that stream big files, the new iomap path is worth an afternoon of measurement. For latency-sensitive small synchronous writes, measure before you believe anything. Either way, the real story is long-term: ext4 is moving onto the same common buffered I/O machinery as other modern filesystems, and a mount option is the safe way to get there.

SOURCES

  1. EXT4 Lands Optional Buffered IOmap For Significant Performance Win With Large Writes — Phoronix
  2. EXT4 Introducing IOmap Buffered I/O Path With Some Performance Gains — Phoronix
  3. Linux 7.4 adds an optional iomap path to ext4 — Neoteo
  4. [PATCH v4 23/23] ext4: introduce a mount option for iomap buffered I/O path — Linux kernel mailing list archive
  5. [PATCH v4 00/23] ext4: use iomap for regular file's buffered I/O path — Linux kernel mailing list archive

Frequently asked questions

How do I enable the ext4 iomap buffered I/O path?

On a Linux 7.4 or newer kernel, mount the filesystem with the buffered_iomap option, for example mount -o buffered_iomap /dev/nvme0n1p3 /mnt/test. It is off by default.

Is ext4 buffered_iomap faster?

Reports on the merge describe large writes getting faster and small 1 KiB writes followed by fsync getting slower. Results depend on your hardware and workload, so benchmark with fio on real storage.

Which ext4 features does buffered_iomap not support?

Online defragmentation, inline data, fs-verity, fscrypt, non-extent inodes and data=journal are reported as unsupported. ext4 can fall back to its original path for those cases.

Should I enable buffered_iomap in production?

Not yet. It is new, opt-in code on the main write path, so test it on scratch storage and wait for stable kernel feedback first.

NEWSLETTER

Get the engineering notes in your inbox.

Kernels, GPUs, networks, AI infrastructure — and the things we broke along the way. No spam, one click to leave.

We store only your email address, to send you new articles. See our privacy policy.

TAGS

ext4iomapLinux 7.4FilesystemsfioPage Cache

RELATED

ENGINEERING NOTES

Things we built.Things we broke.Things we learned.