audk/FatPkg
Mike Turner a131839a3d FatPkg: Improvements to Fat to Fix File Corruption
This patch improves dirty bit checking in FAT and coalesces multiple
writes to adjacent blocks into a single write.

For good read performance, the Fat code caches 64KB lines from the
file system. Any update to the data will force 64KB writes. Writing
the full 64KB causes collateral blocks (i.e. blocks belonging to
other files) to be written. This is inefficient to write blocks that
are not dirty, the FAT driver should only be writing blocks that have
actually been updated through its cache.

This also resolves an issue with existing bootloaders which have ways
to update files outside of the FAT code and the collateral write can
corrupt those files. One such file is the Windows BCD that gets updated
outside of the FAT code and has been seen to be corrupted by the
collateral writes, causing the OS to fail to boot.

This fix keeps track of physical disk block (LBA) size and will only
mark LBA size zones of the 64KB cache line that are written to. When the
file is closed and the cached data is written, only the dirty LBAs are
written, which avoids the collateral write and therefore the corruption.
In addition, adjacent LBAs will be coalesced into one write for
performance considerations.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-09-23 16:50:39 +00:00
..
EnhancedFatDxe FatPkg: Improvements to Fat to Fix File Corruption 2024-09-23 16:50:39 +00:00
FatPei FatPkg/FatPei: Check array offset before use 2023-12-14 21:52:09 +00:00
FatPkg.ci.yaml FatPkg: Improvements to Fat to Fix File Corruption 2024-09-23 16:50:39 +00:00
FatPkg.dec FatPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:57:59 -07:00
FatPkg.dsc FatPkg: Add StackCheckLibNull 2024-09-13 03:58:46 +00:00
FatPkg.uni FatPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:57:59 -07:00
FatPkgExtra.uni FatPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:57:59 -07:00