summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-05-28 09:59:24 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-05-28 09:59:24 +0000
commitd6af04ba915063ae7b646e311bca31a89e68d298 (patch)
tree7275c8cf12bfd0d3361c8e89a006909ac8ee08d7 /apps
parent59953140a7195ae66f866dd2034f77a1adf92605 (diff)
downloadrockbox-d6af04ba915063ae7b646e311bca31a89e68d298.tar.gz
rockbox-d6af04ba915063ae7b646e311bca31a89e68d298.tar.bz2
rockbox-d6af04ba915063ae7b646e311bca31a89e68d298.zip
Load uniqued tags correctly at commit (should fix duplicates). Try
first dircache buffer as it's usually bigger. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10003 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/tagcache.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index f4e139aafa..98beba9b58 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -1495,7 +1495,8 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd)
* table when the index gets resorted.
*/
tempbuf_insert(buf, loc/TAGFILE_ENTRY_CHUNK_LENGTH
- + TAGFILE_MAX_ENTRIES, entry.idx_id, false);
+ + TAGFILE_MAX_ENTRIES, entry.idx_id,
+ tagcache_is_unique_tag(index_type));
yield();
}
logf("done");
@@ -1813,6 +1814,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd)
if (index_type != tag_filename)
h->datasize += tch.datasize;
+ logf("s:%d/%d/%d", index_type, tch.datasize, h->datasize);
error_exit:
close(fd);
@@ -1862,23 +1864,25 @@ static bool commit(void)
}
/* Try to steal every buffer we can :) */
-#ifdef HAVE_TC_RAMCACHE
- if (tempbuf_size == 0 && stat.ramcache_allocated > 0)
- {
- stat.ramcache = false;
- tempbuf = (char *)(hdr + 1);
- tempbuf_size = stat.ramcache_allocated - sizeof(struct ramcache_header);
- }
-#endif
-
#ifdef HAVE_DIRCACHE
if (tempbuf_size == 0)
{
/* Try to steal the dircache buffer. */
tempbuf = dircache_steal_buffer(&tempbuf_size);
+ tempbuf_size &= ~0x03;
}
#endif
+#ifdef HAVE_TC_RAMCACHE
+ if (tempbuf_size == 0 && stat.ramcache_allocated > 0)
+ {
+ stat.ramcache = false;
+ tempbuf = (char *)(hdr + 1);
+ tempbuf_size = stat.ramcache_allocated - sizeof(struct ramcache_header) - 128;
+ tempbuf_size &= ~0x03;
+ }
+#endif
+
/* And finally fail if there are no buffers available. */
if (tempbuf_size == 0)
{
@@ -1909,6 +1913,7 @@ static bool commit(void)
ret = build_index(i, &header, tmpfd);
if (ret <= 0)
{
+ close(tmpfd);
logf("tagcache failed init");
if (ret < 0)
remove_files();
@@ -2176,7 +2181,9 @@ static bool load_tagcache(void)
bytesleft -= sizeof(struct tagfile_entry) + fe->tag_length;
if (bytesleft < 0)
{
- logf("too big tagcache.");
+ logf("too big tagcache #2");
+ logf("tl: %d", fe->tag_length);
+ logf("bl: %d", bytesleft);
close(fd);
return false;
}