summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2010-07-18 18:17:47 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2010-07-18 18:17:47 +0000
commit17d2edf1d22245f96038898d0080b670d8ec125e (patch)
treecd190b48b971378e3d527c455eb2c95010573231
parent7d4414ebd8ba8bb79359a72ccd7d0b71fdb0fd36 (diff)
downloadrockbox-17d2edf1d22245f96038898d0080b670d8ec125e.tar.gz
rockbox-17d2edf1d22245f96038898d0080b670d8ec125e.zip
Properly initialize tagcache headers when doing commit() during
boot-up. Should fix "Recently added" entries remaining empty when dircache is not used nor database is loaded to ram. Also, don't load load hibernated statefile on H1xx targets when database loading to ram has been disabled explicitly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27484 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagcache.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 822a84870c..1094c92a97 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -2858,7 +2858,7 @@ static bool commit(void)
2858 2858
2859 if (tch.magic != TAGCACHE_MAGIC || rc != len) 2859 if (tch.magic != TAGCACHE_MAGIC || rc != len)
2860 { 2860 {
2861 logf("incorrect header"); 2861 logf("incorrect tmpheader");
2862 close(tmpfd); 2862 close(tmpfd);
2863 remove(TAGCACHE_FILE_TEMP); 2863 remove(TAGCACHE_FILE_TEMP);
2864 return false; 2864 return false;
@@ -2872,6 +2872,9 @@ static bool commit(void)
2872 return true; 2872 return true;
2873 } 2873 }
2874 2874
2875 /* Fully initialize existing headers (if any) before going further. */
2876 tc_stat.ready = check_all_headers();
2877
2875#ifdef HAVE_EEPROM_SETTINGS 2878#ifdef HAVE_EEPROM_SETTINGS
2876 remove(TAGCACHE_STATEFILE); 2879 remove(TAGCACHE_STATEFILE);
2877#endif 2880#endif
@@ -4361,8 +4364,11 @@ static void tagcache_thread(void)
4361 4364
4362#ifdef HAVE_TC_RAMCACHE 4365#ifdef HAVE_TC_RAMCACHE
4363# ifdef HAVE_EEPROM_SETTINGS 4366# ifdef HAVE_EEPROM_SETTINGS
4364 if (firmware_settings.initialized && firmware_settings.disk_clean) 4367 if (firmware_settings.initialized && firmware_settings.disk_clean
4368 && global_settings.tagcache_ram)
4369 {
4365 check_done = tagcache_dumpload(); 4370 check_done = tagcache_dumpload();
4371 }
4366 4372
4367 remove(TAGCACHE_STATEFILE); 4373 remove(TAGCACHE_STATEFILE);
4368# endif 4374# endif
@@ -4376,9 +4382,12 @@ static void tagcache_thread(void)
4376 tc_stat.initialized = true; 4382 tc_stat.initialized = true;
4377 4383
4378 /* Don't delay bootup with the header check but do it on background. */ 4384 /* Don't delay bootup with the header check but do it on background. */
4379 sleep(HZ); 4385 if (!tc_stat.ready)
4380 tc_stat.ready = check_all_headers(); 4386 {
4381 tc_stat.readyvalid = true; 4387 sleep(HZ);
4388 tc_stat.ready = check_all_headers();
4389 tc_stat.readyvalid = true;
4390 }
4382 4391
4383 while (1) 4392 while (1)
4384 { 4393 {