summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-08-26 09:24:20 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-08-26 09:24:20 +0000
commit6523ba44a984154b625875dde4997d4363f2b8e7 (patch)
tree68a648663efe61ce07af7703f42fc4effbf48b65
parent7c13843805adbadb744cd375343f41471e837df5 (diff)
downloadrockbox-6523ba44a984154b625875dde4997d4363f2b8e7.zip
rockbox-6523ba44a984154b625875dde4997d4363f2b8e7.tar.gz
rockbox-6523ba44a984154b625875dde4997d4363f2b8e7.tar.bz2
rockbox-6523ba44a984154b625875dde4997d4363f2b8e7.tar.xz
Fixed performance problems when initializing tagcache.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10754 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagcache.c14
-rw-r--r--firmware/common/dircache.c3
2 files changed, 16 insertions, 1 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index a5718c6..d66722e 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -2585,6 +2585,7 @@ static bool parse_changelog_line(int masterfd, const char *buf)
bool tagcache_import_changelog(void)
{
struct master_header myhdr;
+ struct tagcache_header tch;
int clfd, masterfd;
char buf[512];
int pos = 0;
@@ -2610,6 +2611,8 @@ bool tagcache_import_changelog(void)
write_lock++;
+ filenametag_fd = open_tag_fd(&tch, tag_filename, false);
+
/* Fast readline */
while ( 1 )
{
@@ -2649,6 +2652,9 @@ bool tagcache_import_changelog(void)
close(clfd);
close(masterfd);
+ if (filenametag_fd >= 0)
+ close(filenametag_fd);
+
write_lock--;
update_current_serial(current_serial);
@@ -3114,6 +3120,8 @@ static bool load_tagcache(void)
else
# endif
{
+
+# if 0 /* Maybe we could enable this for flash players. Too slow otherwise. */
/* Check if entry has been removed. */
if (global_settings.tagcache_autoupdate)
{
@@ -3129,6 +3137,7 @@ static bool load_tagcache(void)
}
close(testfd);
}
+# endif
}
continue ;
@@ -3287,6 +3296,11 @@ static void build_tagcache(void)
logf("updating tagcache");
+#ifdef HAVE_DIRCACHE
+ while (dircache_is_initializing())
+ sleep(1);
+#endif
+
cachefd = open(TAGCACHE_FILE_TEMP, O_RDONLY);
if (cachefd >= 0)
{
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index d0fdba0..17033e1 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -567,6 +567,7 @@ static int dircache_do_rebuild(void)
memset(fd_bindings, 0, sizeof(fd_bindings));
for (i = 0; i < fdbind_idx; i++)
dircache_bind(fdbind_cache[i].fd, fdbind_cache[i].path);
+ fdbind_idx = 0;
if (thread_enabled)
{
@@ -641,7 +642,7 @@ int dircache_build(int last_size)
if (last_size > DIRCACHE_RESERVE && last_size < DIRCACHE_LIMIT )
{
allocated_size = last_size + DIRCACHE_RESERVE;
- dircache_root = (struct dircache_entry *)buffer_alloc(allocated_size);
+ dircache_root = buffer_alloc(allocated_size);
thread_enabled = true;
/* Start a transparent rebuild. */