Hi all,

My company makes a GPS platform based on WinCE 5.0 S3C2440. It has 64MB of
NAND flash, which is more than enough to fit the mapping application.
However, the map database is fairly large and requires a 1GB SD card.

No problem.

However, when the application runs, it slows to a crawl due to the
excessively fragmented nature of the file accesses it implements. So, I
decided to more carefully examine the caching possibilities of WinCE 5.0.
The FATFS caching is handled by PRIVATE\WINCEOS\COREOS\STORAGE\DISKCACHE.

After much tracing and message printing I noticed that diskcache's algorithm
doesn't have any support for pre-fetching (reading some sectors in advance);
so, for each 1-sector request comming from the upper layers, diskcache reads
only 1 sector from the disk, if there is a cache miss, and stores only that
sector in the buffers; no further read-ahead is done. I cloned and tweaked
diskcache to implement a read-ahead of 64 sectors (minimum) and now the
application starts beautifully with thousands of cache hits; it is about 10
times faster and actually usable.

Am I missing something? Is there any simple configuration that enables the
read-ahead feature? Here are my FATFS customized registry entries:

[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]
"FriendlyName"="FAT FileSystem"
"Flags"=dword:00000064
"Util"="fatutil.dll"
"CacheDll"="diskcache.dll"
"BufferSize"=dword:40
"FatCacheSize"=dword:200
"DataCacheSize"=dword:800
"CacheSize"=dword:800
"DLL"="fatfsd.dll"
"EnableCache"=dword:1
"EnableFatCacheWarm"=dword:0
"EnableDataCacheWarm"=dword:0
"EnableWriteBack"=dword:1
"Paging"=dword:1

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash\FATFS]
"FriendlyName"="FAT FileSystem"
"Dll"="fatfsd.dll"
"Flags"=dword:00280014
"Paging"=dword:1
"CacheSize"=dword:800
"EnableCacheWarm"=dword:0
"EnableCache"=dword:1
"MountFlags"=dword:2
"MountAsROM"=dword:0
"BufferSize"=dword:40
"FatCacheSize"=dword:800
"DataCacheSize"=dword:800
"EnableCache"=dword:1

Besides, if I decide to use my modified diskcache.dll, am I allowed to do
that, since this is derived from the PRIVATE tree?

Thanks!
-H