summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2023-10-07 15:10:53 +0200
committerChristian Soffke <christian.soffke@gmail.com>2024-04-23 23:02:47 -0400
commit3ce3b102ddd5b663759ed61bd689b7bbda2ceecd (patch)
tree73034503c3c4ee4416f2acc6369fd18f99ed8d80
parent4a52147122847afa14e00f12e2b5f813cd1ee41d (diff)
downloadrockbox-3ce3b102ddd5b663759ed61bd689b7bbda2ceecd.tar.gz
rockbox-3ce3b102ddd5b663759ed61bd689b7bbda2ceecd.zip
Provide "quick" option for loading database into RAM
The directory cache and the database's Load to RAM feature each result in a much better user experience. But, when both features are enabled at the same time, it can take a very long time on older players - easily several minutes for larger libraries - until all of the database's dircache references have been updated. Include a 'Quick' option that causes the database to ignore dircache references which can *significantly* reduce disk activity after booting. Change-Id: I25ae779c97d03885b06d5a28d8be55c0d05692a5
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/settings.h9
-rw-r--r--apps/settings_list.c5
-rw-r--r--apps/tagcache.c6
-rw-r--r--manual/rockbox_interface/tagcache.tex17
5 files changed, 45 insertions, 6 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index c41033ec81..b326d5fec0 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -16669,3 +16669,17 @@
16669 *: "Remove Queued Tracks?" 16669 *: "Remove Queued Tracks?"
16670 </voice> 16670 </voice>
16671</phrase> 16671</phrase>
16672<phrase>
16673 id: LANG_QUICK_IGNORE_DIRACHE
16674 desc: in Settings
16675 user: core
16676 <source>
16677 *: "Quick (Ignore Directory Cache)"
16678 </source>
16679 <dest>
16680 *: "Quick (Ignore Directory Cache)"
16681 </dest>
16682 <voice>
16683 *: "Quick (Ignore Directory Cache)"
16684 </voice>
16685</phrase>
diff --git a/apps/settings.h b/apps/settings.h
index 09a01b40a1..ce29e020f7 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -136,6 +136,13 @@ enum
136}; 136};
137#endif 137#endif
138 138
139enum
140{
141 TAGCACHE_RAM_OFF = 0,
142 TAGCACHE_RAM_ON = 1,
143 TAGCACHE_RAM_QUICK = 2
144};
145
139/* dir filter options */ 146/* dir filter options */
140/* Note: Any new filter modes need to be added before NUM_FILTER_MODES. 147/* Note: Any new filter modes need to be added before NUM_FILTER_MODES.
141 * Any new rockbox browse filter modes (accessible through the menu) 148 * Any new rockbox browse filter modes (accessible through the menu)
@@ -576,7 +583,7 @@ struct user_settings
576#endif 583#endif
577#ifdef HAVE_TAGCACHE 584#ifdef HAVE_TAGCACHE
578#ifdef HAVE_TC_RAMCACHE 585#ifdef HAVE_TC_RAMCACHE
579 bool tagcache_ram; /* load tagcache to ram? */ 586 int tagcache_ram; /* load tagcache to ram: 1=on, 2=quick (ignore dircache) */
580#endif 587#endif
581 bool tagcache_autoupdate; /* automatically keep tagcache in sync? */ 588 bool tagcache_autoupdate; /* automatically keep tagcache in sync? */
582 bool autoresume_enable; /* enable auto-resume feature? */ 589 bool autoresume_enable; /* enable auto-resume feature? */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index bc3708bfba..7bdb3522c0 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1813,7 +1813,10 @@ const struct settings_list settings[] = {
1813 1813
1814#ifdef HAVE_TAGCACHE 1814#ifdef HAVE_TAGCACHE
1815#ifdef HAVE_TC_RAMCACHE 1815#ifdef HAVE_TC_RAMCACHE
1816 OFFON_SETTING(F_BANFROMQS,tagcache_ram,LANG_TAGCACHE_RAM,false,"tagcache_ram",NULL), 1816 CHOICE_SETTING(F_BANFROMQS, tagcache_ram, LANG_TAGCACHE_RAM,
1817 0, "tagcache_ram", "off,on,quick",
1818 NULL, 3,
1819 ID2P(LANG_OFF), ID2P(LANG_ON), ID2P(LANG_QUICK_IGNORE_DIRACHE)),
1817#endif 1820#endif
1818 OFFON_SETTING(F_BANFROMQS, tagcache_autoupdate, LANG_TAGCACHE_AUTOUPDATE, false, 1821 OFFON_SETTING(F_BANFROMQS, tagcache_autoupdate, LANG_TAGCACHE_AUTOUPDATE, false,
1819 "tagcache_autoupdate", NULL), 1822 "tagcache_autoupdate", NULL),
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 90f7e01a2f..9463d7c865 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -800,7 +800,8 @@ static long find_entry_ram(const char *filename)
800 struct dircache_fileref dcfref; 800 struct dircache_fileref dcfref;
801 801
802 /* Check if tagcache is loaded into ram. */ 802 /* Check if tagcache is loaded into ram. */
803 if (!tc_stat.ramcache) 803 if (!tc_stat.ramcache
804 || global_settings.tagcache_ram != TAGCACHE_RAM_ON)
804 return -1; 805 return -1;
805 806
806 if (dircache_search(DCS_CACHED_PATH | DCS_UPDATE_FILEREF, &dcfref, 807 if (dircache_search(DCS_CACHED_PATH | DCS_UPDATE_FILEREF, &dcfref,
@@ -5247,7 +5248,8 @@ static void tagcache_thread(void)
5247 if (!tc_stat.ramcache && global_settings.tagcache_ram) 5248 if (!tc_stat.ramcache && global_settings.tagcache_ram)
5248 { 5249 {
5249 load_ramcache(); 5250 load_ramcache();
5250 check_file_refs(global_settings.tagcache_autoupdate); 5251 if (global_settings.tagcache_ram == TAGCACHE_RAM_ON)
5252 check_file_refs(global_settings.tagcache_autoupdate);
5251 if (tc_stat.ramcache && global_settings.tagcache_autoupdate) 5253 if (tc_stat.ramcache && global_settings.tagcache_autoupdate)
5252 tagcache_build(); 5254 tagcache_build();
5253 } 5255 }
diff --git a/manual/rockbox_interface/tagcache.tex b/manual/rockbox_interface/tagcache.tex
index f48aff8e4c..91c0255750 100644
--- a/manual/rockbox_interface/tagcache.tex
+++ b/manual/rockbox_interface/tagcache.tex
@@ -52,10 +52,23 @@ with logging
52 browsing but it does not use extra RAM and saves some battery on boot up. 52 browsing but it does not use extra RAM and saves some battery on boot up.
53 53
54 \opt{HAVE_DISK_STORAGE}{ 54 \opt{HAVE_DISK_STORAGE}{
55 \note{If you browse your music frequently using the database, you should 55 If you browse your music frequently using the database, you should
56 load to RAM, as this will reduce the overall battery consumption because 56 load to RAM, as this will reduce the overall battery consumption because
57 the disk will not need to spin on each search.} 57 the disk will not need to spin on each search.
58 } 58 }
59
60 \note{When Load to RAM is turned on, and the directory cache is enabled as well,
61 it may take an unexpectedly long amount of time for disk activity to
62 wind down after booting, depending on your library size and player.
63
64 This can be mitigated by choosing the \setting{Quick} option instead, which causes
65 the database to ignore cached file references. In that case, you may notice brief
66 moments of disk activity once the path for a database entry has to be retrieved.
67
68 Set to \setting{On}, if you plan to take advantage the database's Update function,
69 or use a WPS that displays multiple upcoming tracks from the current playlist.
70 Otherwise, you may notice file names instead of metadata being displayed for those
71 tracks.}
59 } 72 }
60 73
61\item[Auto Update] 74\item[Auto Update]