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
This commit is contained in:
Miika Pekkarinen 2010-07-18 18:17:47 +00:00
parent 7d4414ebd8
commit 17d2edf1d2

View file

@ -2858,7 +2858,7 @@ static bool commit(void)
if (tch.magic != TAGCACHE_MAGIC || rc != len)
{
logf("incorrect header");
logf("incorrect tmpheader");
close(tmpfd);
remove(TAGCACHE_FILE_TEMP);
return false;
@ -2872,6 +2872,9 @@ static bool commit(void)
return true;
}
/* Fully initialize existing headers (if any) before going further. */
tc_stat.ready = check_all_headers();
#ifdef HAVE_EEPROM_SETTINGS
remove(TAGCACHE_STATEFILE);
#endif
@ -4361,8 +4364,11 @@ static void tagcache_thread(void)
#ifdef HAVE_TC_RAMCACHE
# ifdef HAVE_EEPROM_SETTINGS
if (firmware_settings.initialized && firmware_settings.disk_clean)
if (firmware_settings.initialized && firmware_settings.disk_clean
&& global_settings.tagcache_ram)
{
check_done = tagcache_dumpload();
}
remove(TAGCACHE_STATEFILE);
# endif
@ -4376,9 +4382,12 @@ static void tagcache_thread(void)
tc_stat.initialized = true;
/* Don't delay bootup with the header check but do it on background. */
if (!tc_stat.ready)
{
sleep(HZ);
tc_stat.ready = check_all_headers();
tc_stat.readyvalid = true;
}
while (1)
{