TFAT Registry Settings (Windows CE 5.0)
The Transaction-Safe FAT (TFAT) file system retrieves driver specific settings from the registry. TFAT is a super-set of FATFS. While most TFAT registry settings are the same as those used for FATFS, some are unique to TFAT.
You can place settings for TFAT at two different FATFS tiers in the registry hierarchy
Root file system key
Settings made at the root key of the file system registry,
HKEY_LOCAL_MACHINE\System\StorageManager\FATFS,
apply to every mounted instance of FATFS, unless explicitly overridden by a setting at a lower level. These setting apply to FATFS for all profiles.Profile-specific settings
Settings made at the Profiles registry subkey,
HKEY_LOCAL_MACHINE\System\StorageManager\Profile\<MyProfileName>\FATFS
, apply only to mounted instances of FATFS on devices that report the profile <MyProfileName
>.
The following table shows the registry settings for the FAT file system that you can place in
HKEY_LOCAL_MACHINE\System\StorageManager\FATFS
- or -
HKEY_LOCAL_MACHINE\System\StorageManager\Profile\<MyProfileName>\FATFS.
Registry value: Type | Description |
---|---|
BufferSize: REG_DWORD | Specifies the number of sector-sized buffers to use for streams.
The default value is 64 for TFAT and 32 for FAT. |
CacheSize: REG_DWORD | This value is deprecated for Windows CE 5.0 and later. Replace with FatCacheSize or DataCacheSize.
Indicates the size of the disk cache, in number of sectors. This value must be a power of 2 and at least 16 sectors. If set to zero, FATFS will determine the best cache size to use. For more information, see CacheSize registry subkey. |
CodePage: REG_DWORD | Overrides CP_OEMCP in all character conversions. |
DataCacheSize: REG_DWORD | Indicates the size of the data cache, in number of sectors. This value must be a power of 2 and at least 16 sectors. If set to zero, FATFS will determine the best cache size to use, up to twice the size of FatCacheSize.
For more information, see CacheSize registry subkey. |
Dll: REG_SZ | Specifies the name of the file system DLL. |
EnableCache: REG_DWORD | Controls caching.
|
EnableCacheWarm: REG_DWORD | This value is deprecated for Windows CE 5.0 and later. Replace with EnableFatCacheWarm or EnableDataCacheWarm.
Set to 1 to enable pre-warming of the Fat cache. That is, the cache is pre-loaded to capacity with data on initialization. |
EnableFatCacheWarm: REG_DWORD | Set to 1 to enable pre-warming of the data cache. That is, the cache is pre-loaded to capacity with data on initialization. For example, if the cache is n sectors, the first n sectors of the cached region is read from disk. |
EnableDataCacheWarm: REG_DWORD | Set to 1 to enable pre-warming of the cache. That is, the cache is pre-loaded to capacity with data on initialization. For example, if the cache is n sectors, the first n sectors of the cached region is read from disk. |
EnableWriteBack: REG_DWORD | Enables a write-back or write-through cache. This setting applies only to Windows CE 5.0 and later.
|
FatCacheSize: REG_DWORD | Indicates the size of the FAT cache, in number of sectors. This value must be a power of 2 and at least 16 sectors. If set to zero, FATFS will determine the best cache size to use, based on size of the FATFS up to 512 sectors.
For more information, see CacheSize registry subkey. |
Flags: REG_DWORD | Indicates FAT file system registry flags. Default is 64.
For more information, see Flags registry subkey. |
FormatTfat: REG_DWORD | Set to 1 to format the volume as TFAT on auto-format or through IOCTL_DISK_FORMAT_VOLUME. |
FriendlyName: REG_SZ | Specifies a friendly name for the file system. |
MountLabel: REG_DWORD | Pulls the volume label and uses it as a mount point. |
Paging: REG_DWORD | Controls paging.
|
Util: REG_SZ | Specifies the DLL name of utility to do format and scan. |
MountFlags: REG_DWORD | This value is deprecated for Windows CE 5.0 and later. For replacement values, see Mount Settings. |
LazyWriterThreadPrio256: REG_DWORD | Sets the priority of the lazy writer thread. Default is idle.
For more information, see Lazy-Writer Thread. |
**Note **When you enable pre-warming of the FAT or data cache, you trade longer boot times for quicker cache access when fully booted. To determine the settings that offer the best performance for your target device, experiment with different values for EnableFatCacheWarm and EnableDataCacheWarm.
Improving TFAT Performance
Registry hive files are memory-mapped, causing very slow performance with a registry hive on a TFAT volume. You can improve this performance by setting appropriate registry values.
The following list shows the registry keys that offer the greatest potential for improving performance.
- FATFS_WFWS_NOWRITETHRU
- EnableCache
- EnableWriteBack
- EnableFatCacheWarm
- FatCacheSize
- EnableDataCacheWarm
- DataCacheSize
To obtain the greatest benefit from using these settings, measure performance before and after making a change, and test using scenarios that are important to your design.
Atomic Sector Writes
TFAT requires the underlying block structure to support atomic sector writes. The flash driver and most CF card hardware provide atomic sector write operations. In cases where the block driver is not atomic, TFAT cannot guarantee transaction safety.
The following settings are recommended for hard drives and other media with non-atomic sector writes:
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\HDProfile\FATFS]
"Flags"=dword:00280014
The following settings are recommended for storage media with atomic sector writes:
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<Profile Name>\FATFS]
"Flags"=dword:00000014
Default TFAT Settings
The following registry key example is the default for the TFAT file system; profiles can override these values:
[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]
"FriendlyName"="TFAT FileSystem"
"Dll"="fatfsd.dll"
"Flags"=dword:00000024
"Paging"=dword:1
"CacheSize"=dword:0
Flags registry subkey
The following table shows the available values you can set for the Flags registry subkey; set Flags to a combination of these values.
Flag | Value | Description |
---|---|---|
FATFS_UPDATE_ACCESS | 0x00000001 | Updates access times. |
FATFS_DISABLE_LOG | 0x00000002 | Disables event logging. |
FATFS_DISABLE_AUTOSCAN | 0x00000004 | Disables automatic calls to ScanVolume. |
FATFS_VERIFY_WRITES | 0x00000008 | Verifies all writes. |
FATFS_ENABLE_BACKUP_FAT | 0x00000010 | Adds a backup FAT to all formats. |
FATFS_FORCE_WRITETHROUGH | 0x00000020 | Sets all files to WRITE_THROUGH, regardless of the parameters to CreateFile. |
FATFS_DISABLE_AUTOFORMAT | 0x00000040 | Disables automatic formatting of unformatted volumes. |
FATFS_WFWS_NOWRITETHRU | 0x00010000 | Disables write through on the WriteFileWithSeek function. Improves memory-mapped file performance. |
FATFS_DISABLE_FORMAT | 0x00020000 | Disables format. |
FATFS_TRANS_DATA | 0x00040000 | Transacts data on a write operation. |
FATFS_TFAT_NONATOMIC_SECTOR | 0x00080000 | Uses the cluster 1 entry in the FAT table for a TFAT transaction. TFAT uses the NOF field of the boot sector by default. |
FATFS_DISABLE_TFAT_REDIR | 0x00100000 | Disables the redirect of the root directory to another hidden directory for FAT12 or 16. |
FATFS_TFAT_ALWAYS | 0x00200000 | Marks transaction status, even if only one sector in FAT is changed. |
FATFS_FORCE_TFAT | 0x00400000 | Forces TFAT transactions even if the volume is not formatted as TFAT. |
FATFS_LFN_EXTENDED | 0x00800000 | Generate LFN entries for extended characters always |
FATFS_TFAT_DISABLE_MOVEDIR | 0x01000000 | Disable movefile on a directory for TFAT because it isn't transaction-safe |
See Also
Transaction-Safe FAT File System | FlushFileBuffers
Send Feedback on this topic to the authors