1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 11:59:50 +03:00

Fixed bug in Disk Cache: reads bigger than cache block size were not handled properly

This commit is contained in:
Damjan Adamic 2016-04-17 18:37:24 +02:00
parent e62759e5f2
commit d2923a32d3

View file

@ -96,6 +96,12 @@ DRESULT DiskCache::read(BYTE drv, BYTE* buff, DWORD sector, UINT count)
// return __disk_read(drv, buff, sector, count);
// }
// if read is bigger than cache block, then read it directly without using cache
if (count > DISK_CACHE_BLOCK_SECTORS) {
TRACE_DISK_CACHE("\t\t big read(%u, %u)", this, (uint32_t)sector, (uint32_t)count);
return __disk_read(drv, buff, sector, count);
}
for(int n=0; n < DISK_CACHE_BLOCKS_NUM; ++n) {
if (blocks[n].read(buff, sector, count)) {
++stats.noHits;