forked from len0rd/rockbox
Fixed performance problems when initializing tagcache.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10754 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7c13843805
commit
6523ba44a9
2 changed files with 16 additions and 1 deletions
|
|
@ -2585,6 +2585,7 @@ static bool parse_changelog_line(int masterfd, const char *buf)
|
||||||
bool tagcache_import_changelog(void)
|
bool tagcache_import_changelog(void)
|
||||||
{
|
{
|
||||||
struct master_header myhdr;
|
struct master_header myhdr;
|
||||||
|
struct tagcache_header tch;
|
||||||
int clfd, masterfd;
|
int clfd, masterfd;
|
||||||
char buf[512];
|
char buf[512];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
@ -2610,6 +2611,8 @@ bool tagcache_import_changelog(void)
|
||||||
|
|
||||||
write_lock++;
|
write_lock++;
|
||||||
|
|
||||||
|
filenametag_fd = open_tag_fd(&tch, tag_filename, false);
|
||||||
|
|
||||||
/* Fast readline */
|
/* Fast readline */
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
|
|
@ -2649,6 +2652,9 @@ bool tagcache_import_changelog(void)
|
||||||
close(clfd);
|
close(clfd);
|
||||||
close(masterfd);
|
close(masterfd);
|
||||||
|
|
||||||
|
if (filenametag_fd >= 0)
|
||||||
|
close(filenametag_fd);
|
||||||
|
|
||||||
write_lock--;
|
write_lock--;
|
||||||
|
|
||||||
update_current_serial(current_serial);
|
update_current_serial(current_serial);
|
||||||
|
|
@ -3114,6 +3120,8 @@ static bool load_tagcache(void)
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
|
|
||||||
|
# if 0 /* Maybe we could enable this for flash players. Too slow otherwise. */
|
||||||
/* Check if entry has been removed. */
|
/* Check if entry has been removed. */
|
||||||
if (global_settings.tagcache_autoupdate)
|
if (global_settings.tagcache_autoupdate)
|
||||||
{
|
{
|
||||||
|
|
@ -3129,6 +3137,7 @@ static bool load_tagcache(void)
|
||||||
}
|
}
|
||||||
close(testfd);
|
close(testfd);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
continue ;
|
continue ;
|
||||||
|
|
@ -3287,6 +3296,11 @@ static void build_tagcache(void)
|
||||||
|
|
||||||
logf("updating tagcache");
|
logf("updating tagcache");
|
||||||
|
|
||||||
|
#ifdef HAVE_DIRCACHE
|
||||||
|
while (dircache_is_initializing())
|
||||||
|
sleep(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
cachefd = open(TAGCACHE_FILE_TEMP, O_RDONLY);
|
cachefd = open(TAGCACHE_FILE_TEMP, O_RDONLY);
|
||||||
if (cachefd >= 0)
|
if (cachefd >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -567,6 +567,7 @@ static int dircache_do_rebuild(void)
|
||||||
memset(fd_bindings, 0, sizeof(fd_bindings));
|
memset(fd_bindings, 0, sizeof(fd_bindings));
|
||||||
for (i = 0; i < fdbind_idx; i++)
|
for (i = 0; i < fdbind_idx; i++)
|
||||||
dircache_bind(fdbind_cache[i].fd, fdbind_cache[i].path);
|
dircache_bind(fdbind_cache[i].fd, fdbind_cache[i].path);
|
||||||
|
fdbind_idx = 0;
|
||||||
|
|
||||||
if (thread_enabled)
|
if (thread_enabled)
|
||||||
{
|
{
|
||||||
|
|
@ -641,7 +642,7 @@ int dircache_build(int last_size)
|
||||||
if (last_size > DIRCACHE_RESERVE && last_size < DIRCACHE_LIMIT )
|
if (last_size > DIRCACHE_RESERVE && last_size < DIRCACHE_LIMIT )
|
||||||
{
|
{
|
||||||
allocated_size = last_size + DIRCACHE_RESERVE;
|
allocated_size = last_size + DIRCACHE_RESERVE;
|
||||||
dircache_root = (struct dircache_entry *)buffer_alloc(allocated_size);
|
dircache_root = buffer_alloc(allocated_size);
|
||||||
thread_enabled = true;
|
thread_enabled = true;
|
||||||
|
|
||||||
/* Start a transparent rebuild. */
|
/* Start a transparent rebuild. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue