A small change to the Linux FAT driver, included in Linux 7.4, substantially speeds up a specific file-allocation operation on FAT32. When software pre-allocates disk space using FALLOC_FL_KEEP_SIZE, it reserves storage without increasing the file’s reported length. Previously, the driver handled this by repeatedly allocating one cluster at a time as the file’s reserved space grew. Developer Matheus Alves de Almeida changed the allocation path so it can reserve multiple clusters in a single operation.
Benchmarks shared by Almeida show improvements of up to 265 times, with gains across the tested cases. The result comes from reducing the repeated work involved in cluster-by-cluster allocation, rather than changing FAT32’s on-disk format or the behavior of the KEEP_SIZE flag. The patch is only a few lines long and was merged into Linux 7.4 through a non-memory-management pull request submitted by Andrew Morton. The reported speed-up applies to this particular pre-allocation workload; it does not indicate that all FAT32 operations or general file access are hundreds of times faster.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.