Project

General

Profile

Bug #7976

libstand/dosfs: cache FAT32 in 128 Kb blocks to save loader memory

Added by Toomas Soome almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
bootloader
Start date:
2017-03-17
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

Work done by Mikhail Kupchik. Currently in reviewed state and not yet commited, I did testing at illumos side:

https://reviews.freebsd.org/D9547

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."

History

#1

Updated by Electric Monk almost 3 years ago

  • % Done changed from 90 to 100
  • Status changed from In Progress to Closed

git commit 63982b82e639bf9f496423925738dd3f86bda7aa

commit  63982b82e639bf9f496423925738dd3f86bda7aa
Author: Toomas Soome <tsoome@me.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 <rm@joyent.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF