diskcache: Size the buffers for MAX_LOG_SECTOR_SIZE

Because if we get a logical sector size > min sector size
we'll trigger buffer overflows.

Change-Id: Ibd24f91a0f8601fbd8c5a5dfeef4ebe5c081f664
This commit is contained in:
Solomon Peachy 2024-11-04 07:22:49 -05:00
parent e29ddfb6be
commit f58fad943e
2 changed files with 13 additions and 10 deletions

View file

@ -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 */