Increase maximum files in directory limit

Increase the default limit to 5000 files for targets with at
least 8 MiB of RAM (the vast majority). The upper limit of the
setting is now 40,000 or 100,000 if you have at least 8 MiB or
16 MiB of RAM, respectively.

Update the manual to mention that this setting can also impact
the database browser. "Using the Database" already mentions it,
but it's useful to say so in the setting's description.

Change-Id: I6f204eec6cf2ccaea2af81d2fa287f92476eed4a
This commit is contained in:
Aidan MacDonald 2023-01-02 20:18:21 +00:00
parent 9d6f9441ae
commit a23ae63a31
2 changed files with 40 additions and 15 deletions

View file

@ -354,6 +354,31 @@ static const char graphic_numeric[] = "graphic,numeric";
# endif # endif
#endif #endif
/*
* Total buffer size due to this setting = max files in dir * 52 bytes
* Keep this in mind when selecting the maximum - if the maximum is too
* high it's possible rockbox could hit OOM and become unusable until
* the config file is deleted manually.
*
* Note the FAT32 limit is 65534 files per directory, but this limit
* also applies to the database browser so it makes sense to support
* larger maximums.
*/
#if MEMORYSIZE >= 16
# define MAX_FILES_IN_DIR_DEFAULT 5000
# define MAX_FILES_IN_DIR_MAX 100000
# define MAX_FILES_IN_DIR_STEP 1000
#elif MEMORYSIZE >= 8
# define MAX_FILES_IN_DIR_DEFAULT 5000
# define MAX_FILES_IN_DIR_MAX 40000
# define MAX_FILES_IN_DIR_STEP 500
#else
/* historical defaults, only for 2 MiB targets these days */
# define MAX_FILES_IN_DIR_DEFAULT 1000
# define MAX_FILES_IN_DIR_MAX 10000
# define MAX_FILES_IN_DIR_STEP 50
#endif
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
static const char* list_pad_formatter(char *buffer, size_t buffer_size, static const char* list_pad_formatter(char *buffer, size_t buffer_size,
int val, const char *unit) int val, const char *unit)
@ -1028,13 +1053,10 @@ const struct settings_list settings[] = {
"max files in playlist", UNIT_INT, 1000, 32000, 1000, "max files in playlist", UNIT_INT, 1000, 32000, 1000,
NULL, NULL, NULL), NULL, NULL, NULL),
INT_SETTING(F_BANFROMQS, max_files_in_dir, LANG_MAX_FILES_IN_DIR, INT_SETTING(F_BANFROMQS, max_files_in_dir, LANG_MAX_FILES_IN_DIR,
#if MEMORYSIZE > 1 MAX_FILES_IN_DIR_DEFAULT, "max files in dir", UNIT_INT,
1000, MAX_FILES_IN_DIR_STEP /* min */, MAX_FILES_IN_DIR_MAX,
#else MAX_FILES_IN_DIR_STEP,
200, NULL, NULL, NULL),
#endif
"max files in dir", UNIT_INT, 50, 10000, 50,
NULL, NULL, NULL),
/* use this setting for user code even if there's no exchangable battery /* use this setting for user code even if there's no exchangable battery
* support enabled */ * support enabled */
#if BATTERY_CAPACITY_INC > 0 #if BATTERY_CAPACITY_INC > 0

View file

@ -102,18 +102,21 @@ This sub menu relates to limits in the Rockbox operating system.
\begin{description} \begin{description}
\item [Max Entries in File Browser.] This setting controls the limit on \item [Max Entries in File Browser.] This setting controls the limit on
the number of files that you can see in any particular directory in the the number of files that you can see in any particular directory in the
file browser. You can configure the size to be between 50 and file browser. \opt{HAVE_DISK_STORAGE}{Higher values will shorten the music
10,000 files in steps of 50. The default is 400. \opt{HAVE_DISK_STORAGE}{ buffer, which can negatively affect battery life by forcing the disk to
Higher values will shorten the music buffer, which can negatively affect spin up more often. Increase this setting \emph{only} if you need to.}
battery life by forcing the disk to spin up more often. Increase this
setting \emph{only} if you need to.} \note{This setting also affects the maximum number of tracks that can
be handled by the database browser. If you find that long lists are not
being sorted correctly in the database browser you may need to increase
this setting.}
\item [Max Playlist Size.] This setting controls the maximum size of \item [Max Playlist Size.] This setting controls the maximum size of
a playlist. The playlist size can be between 1,000 and 32,000 files, a playlist. The playlist size can be between 1,000 and 32,000 files,
in steps of 1,000 (default is 10,000). \opt{HAVE_DISK_STORAGE}{Higher in steps of 1,000 (default is 10,000). \opt{HAVE_DISK_STORAGE}{Higher
values will shorten the music buffer, which can negatively affect battery values will shorten the music buffer, which can negatively affect
life by forcing the disk to spin up more often. Increase this setting battery life by forcing the disk to spin up more often. Increase this
\emph{only} if you use very large playlists.} setting \emph{only} if you use very large playlists.}
\item [Glyphs To Cache.] This sets the default memory allocation size \item [Glyphs To Cache.] This sets the default memory allocation size
for fonts in unique glyphs. This should be set to the number of unique for fonts in unique glyphs. This should be set to the number of unique