diff --git a/firmware/common/disk.c b/firmware/common/disk.c index 958f09755a..f016a7c196 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -173,7 +173,7 @@ bool disk_init(IF_MD_NONVOID(int drive)) disk_writer_unlock(); #ifdef MAX_LOG_SECTOR_SIZE - if (info->sector_size > MAX_LOG_SECTOR_SIZE) { + if (info->sector_size > MAX_LOG_SECTOR_SIZE || info->sector_size > DC_CACHE_BUFSIZE) { panicf("Unsupported logical sector size: %d", info->sector_size); } @@ -185,7 +185,7 @@ bool disk_init(IF_MD_NONVOID(int drive)) #endif #endif /* CONFIG_STORAGE & STORAGE_ATA */ - memset(sector, 0, LOG_SECTOR_SIZE(drive)); + memset(sector, 0, DC_CACHE_BUFSIZE); storage_read_sectors(IF_MD(drive,) 0, 1, sector); bool init = false; diff --git a/firmware/include/fs_defines.h b/firmware/include/fs_defines.h index f4c8385d8a..1c8c3afe2b 100644 --- a/firmware/include/fs_defines.h +++ b/firmware/include/fs_defines.h @@ -35,14 +35,6 @@ #define MAX_COMPNAME 260 -/* still experimental? */ -/* increasing this will increase the total memory used by the cache; the - cache, as noted in disk_cache.h, has other minimum requirements that may - prevent reducing its number of entries in order to compensate */ -#ifndef SECTOR_SIZE -#define SECTOR_SIZE 512 -#endif - /* limits for number of open descriptors - if you increase these values, make certain that the disk cache has enough available buffers */ @@ -108,7 +100,18 @@ #define DC_MAP_NUM_ENTRIES 256 #endif /* MEMORYSIZE */ +/* increasing this will increase the total memory used by the cache; the + cache, as noted in disk_cache.h, has other minimum requirements that may + prevent reducing its number of entries in order to compensate */ +#ifndef SECTOR_SIZE +#define SECTOR_SIZE 512 +#endif + /* this _could_ be larger than a sector if that would ever be useful */ +#ifdef MAX_LOG_SECTOR_SIZE +#define DC_CACHE_BUFSIZE MAX_LOG_SECTOR_SIZE +#else #define DC_CACHE_BUFSIZE SECTOR_SIZE +#endif #endif /* FS_DEFINES_H */