Hardware

Linux 7.4 FAT32 patch makes file pre-allocation up to 265x faster

By One Percent Lows

TL;DR

A new patch series for the Linux 7.4 FAT32 driver can make file space pre-allocation up to 265x faster on synchronous mounts, according to developer Matheus Alves de Almeida.

Developer Matheus Alves de Almeida has submitted a three-patch series to the Linux 7.4 FAT32 driver that targets the fallocate() call in keep-size mode. The patches aim to stop the driver from allocating disk space one cluster at a time. Previously, the driver would allocate a single cluster and update the allocation table before moving to the next. The new code adds a helper to attach a chain of clusters to a file in one call.

On synchronous mounts, Alves de Almeida reports that pre-allocating a file dropped from 92 seconds to about a third of a second, a speed increase of up to 265x. This specific gain is limited to space pre-allocation and does not affect ordinary file copies or writes. The performance figures come from tests conducted inside a QEMU/KVM virtual setup utilizing a virtio disk arrangement rather than physical media.

Alves de Almeida has also proposed a follow-up patch to batch writes for the FAT allocation table backup. His tests show roughly 4x gains for that process on synchronous mounts, with no change on normal mounts. Andrew Morton merged the initial patches during the Linux 7.4 merge window. Linux 7.4 is expected around the end of the year.

More on Linux gaming