On a PCIe Gen5 NVMe drive, a single CPU core running io_uring in poll mode could push about 3.2 million 4K random reads per second to the raw block device, but only about 1.92 million through EXT4 or XFS. One of the first filesystem pulls merged for Linux 7.3 narrows that gap.
The pull request, merged Monday and covered by Phoronix, does two things to iomap, the framework many Linux filesystems use to map file offsets to locations on disk. It adds a simple direct I/O path for small reads, which “takes ext4 from 1.92M to 2.19M IOPS in the original workload,” according to the pull request. In fio runs on both EXT4 and XFS, the gains were about 4% at libaio queue depths of 64 and higher, around 5% with io_uring, and up to 10% in io_uring poll mode at a queue depth of 256.
ByteDance engineer Fengnan Chang found the bottleneck, which Phoronix first reported in July: during 4K random reads, much of the CPU time went to memory allocations and iomap’s direct I/O state machine. His fast path applies when the read is no larger than the inode’s block size and the file isn’t encrypted.
Fewer indirect calls
The other half is structural. A 21-patch series from Joanne Koong, posted to the kernel lists in July, finishes converting iomap to an iterator model, following a suggestion from Christoph Hellwig and reviving an earlier RFC from Matthew Wilcox. Until now, every iomap operation went through a pair of callbacks, iomap_begin() and iomap_end(), and “every step of every iteration is an indirect call, including on the hottest paths,” the cover letter says. The series replaces them with a single iomap_next() callback that a performance-critical caller can pass as a compile-time constant, letting the compiler turn it into a direct, inlineable call.
The series is meant to change no behavior. Besides EXT4 and XFS, the conversion touches Btrfs, EXT2, EROFS, F2FS, GFS2, HPFS, FUSE, exFAT, ZoneFS, NTFS and NTFS3. To avoid disrupting filesystems landing their own iomap work during the merge window, Koong planned to merge the final three patches, which remove the old begin/end path, after 7.3-rc1 is tagged.
Only EXT4 and XFS numbers were published, and all came from single-core tests on Gen5 hardware, so results on busier multi-core systems may differ.


WebProNews is an iEntry Publication