From 17d2edf1d22245f96038898d0080b670d8ec125e Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Sun, 18 Jul 2010 18:17:47 +0000 Subject: 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 --- apps/tagcache.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'apps') 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) 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. */ - sleep(HZ); - tc_stat.ready = check_all_headers(); - tc_stat.readyvalid = true; + if (!tc_stat.ready) + { + sleep(HZ); + tc_stat.ready = check_all_headers(); + tc_stat.readyvalid = true; + } while (1) { -- cgit v1.2.3