mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-01 00:05:06 +01:00
- reverted .last_access handling to use the static counter. Old behaviour - counting up .last_access directly - lead to a heavy performance impact.
This commit is contained in:
parent
5324215493
commit
980ade67d4
@ -101,14 +101,14 @@ void _FAT_cache_destructor (CACHE* cache) {
|
||||
_FAT_mem_free (cache);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
static u32 accessCounter = 0;
|
||||
|
||||
static u32 accessTime(){
|
||||
accessCounter++;
|
||||
return accessCounter;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
static CACHE_ENTRY* _FAT_cache_getPage(CACHE *cache,sec_t sector)
|
||||
{
|
||||
@ -123,7 +123,7 @@ static CACHE_ENTRY* _FAT_cache_getPage(CACHE *cache,sec_t sector)
|
||||
|
||||
for(i=0;i<numberOfPages;i++) {
|
||||
if(sector>=cacheEntries[i].sector && sector<(cacheEntries[i].sector + cacheEntries[i].count)) {
|
||||
cacheEntries[i].last_access++;
|
||||
cacheEntries[i].last_access = accessTime();
|
||||
return &(cacheEntries[i]);
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ static CACHE_ENTRY* _FAT_cache_getPage(CACHE *cache,sec_t sector)
|
||||
|
||||
cacheEntries[oldUsed].sector = sector;
|
||||
cacheEntries[oldUsed].count = sectorsPerPage;
|
||||
cacheEntries[oldUsed].last_access++;
|
||||
cacheEntries[oldUsed].last_access = accessTime();
|
||||
|
||||
return &(cacheEntries[oldUsed]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user