Yesterday, Linus Torvalds released the Linux kernel 5.7-rc1 after closing its merge window. But days before that, OGAWA Hirofumi, kernel developer, sent out a patch for improving the speed of file transfer in the FAT filesystem.
The patch code aims to enhance the readahead performance of the FAT filesystem code for Linux. If you don’t know, readahead is a system call of the Linux kernel that prefetches the data and loads it into the page cache. In this way, the file transfer speeds up as the data are read from physical memory rather than from disk.
Linux Kernel Improving The Legacy Code
Earlier, we reported the lining up of improvements in the floppy driver and exFAT (modern replacement of FAT) driver code for Linux kernel 5.7. This time, Linux kernel is adding new and improved code to the old FAT16/FAT32 file system.
Most modern devices support extended FAT(exFAT) but some still use FAT; for instance, digital cameras or EFI partitions. But the current readahead for FAT entries has some flaws that reduce its file-transfer speed.
Hence, the new code makes the FAT readahead size-tunable and updates the readahead window before exhausting it. Moreover, the new changes also avoid small size I/O requests to improve overall file transfer performance.
To prove it practically, Hyeongseok Kim reviewed and tested the patch on a slow USB connected 2TB hard disk drive. And the results showed a decrease in file transfer time from the previous 383.18 seconds to the new 51.03 seconds.
You can check out the patch code found on the mailing list. Though it is too late to include in Linux 5.7, we can hopefully expect it to get pushed into kernel 5.8.