libstand/dosfs: cache FAT32 in 128 Kb blocks to save loader memory
Work done by Mikhail Kupchik. Currently in reviewed state and not yet commited, I did testing at illumos side:
Copy from the summary from the review above:
"Current implementation of dosfs in libstand reads full File Allocation Table to the RAM in the initialization code. In the extreme case of FAT32 filesystem, this structure will take up to 256-1024 Mb of loader memory, depending on the cluster size.
Proposed patch reduces libstands/dosfs memory requirements to 128 Kb for all variants of dosfs filesystem. For FAT12 and FAT16 filesystems, File Allocation Table is cached in full, as before. For FAT32, File Allocation Table is broken into the equal blocks of 128 Kilobytes (32768 entries), and only current block is cached.
In my measurements, I could not find any performance degradation caused by this patch. FAT32 cache misses occur with ~ 1/10000 probability, so this patch doesn't hurt performance much, but allows to save significant amount of memory in the loader environment. Additionally, loader time is saved by avoiding loading of non-relevant 128K-blocks from the File Allocation Table on disk.
Because per-filesystem context is now small, global FAT cache (for all instances of dosfs filesystem) is replaced by local per-instance cache."
Updated by Electric Monk about 3 years ago
- % Done changed from 90 to 100
- Status changed from In Progress to Closed
commit 63982b82e639bf9f496423925738dd3f86bda7aa Author: Toomas Soome <email@example.com> Date: 2017-04-23T01:58:39.000Z 7976 libstand/dosfs: cache FAT32 in 128 Kb blocks to save loader memory Reviewed by: Robert Mustacchi <firstname.lastname@example.org> Approved by: Dan McDonald <email@example.com>