mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
storage: Disk Cache buffer size may need to be larger than SECTOR_SIZE
The file I/O code operates in terms of the FILESYSTEM sector size, which may be much larger than the underlying device's logical sector size. So the disk cache buffers need to be the the larger of: * Max allowed filesystem sector size (MAX_VIRT_SECTOR_SIZE) (if defined) * Max allowed logical sector size (MAX_VARIABLE_LOG_SECTOR) (if defined) * Fixed logical size (SECTOR_SIZE) Change-Id: Ica0ec36d113406f24c12c696317a8d3520e7852c
This commit is contained in:
parent
7df324b819
commit
dcec6828a3
1 changed files with 25 additions and 5 deletions
|
@ -107,10 +107,30 @@
|
||||||
#define SECTOR_SIZE 512
|
#define SECTOR_SIZE 512
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this _could_ be larger than a sector if that would ever be useful */
|
/* The file I/O code operates in terms of the FILESYSTEM sector size,
|
||||||
#ifdef MAX_VARIABLE_LOG_SECTOR
|
which may be much larger than the underlying device's logical sector size.
|
||||||
|
So we have to use the larger of the filesystem's max, the max logical, or
|
||||||
|
the the fixed logical size.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(MAX_VIRT_SECTOR_SIZE) && defined(MAX_VARIABLE_LOG_SECTOR)
|
||||||
|
#if (MAX_VIRT_SECTOR_SIZE < MAX_VARIABLE_LOG_SECTOR)
|
||||||
|
#error "MAX_VIRT_SECTOR_SIZE < MAX_VARIABLE_LOG_SECTOR"
|
||||||
|
#endif
|
||||||
|
#if (MAX_VIRT_SECTOR_SIZE % MAX_VARIABLE_LOG_SECTOR)
|
||||||
|
#error "MAX_VIRT_SECTOR_SIZE is not a multiple of MAX_VARIABLE_LOG_SECTOR"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(DC_CACHE_BUFSIZE) && defined(MAX_VIRT_SECTOR_SIZE)
|
||||||
|
#define DC_CACHE_BUFSIZE MAX_VIRT_SECTOR_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(DC_CACHE_BUFSIZE) && defined(MAX_VARIABLE_LOG_SECTOR)
|
||||||
#define DC_CACHE_BUFSIZE MAX_VARIABLE_LOG_SECTOR
|
#define DC_CACHE_BUFSIZE MAX_VARIABLE_LOG_SECTOR
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
|
#if !defined(DC_CACHE_BUFSIZE)
|
||||||
#define DC_CACHE_BUFSIZE SECTOR_SIZE
|
#define DC_CACHE_BUFSIZE SECTOR_SIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue