commit preload for openSUSE:Factory
Hello community, here is the log from the commit of package preload for openSUSE:Factory checked in at Mon Nov 2 22:27:16 CET 2009. -------- --- preload/preload.changes 2009-10-15 10:04:40.000000000 +0200 +++ /mounts/work_src_done/STABLE/preload/preload.changes 2009-11-02 21:55:01.000000000 +0100 @@ -1,0 +2,5 @@ +Mon Nov 2 20:54:36 UTC 2009 - coolo@novell.com + +- fix the logic in the worker thread (bnc#551801) + +------------------------------------------------------------------- calling whatdependson for head-i586 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ preload.spec ++++++ --- /var/tmp/diff_new_pack.hG3Nxf/_old 2009-11-02 22:27:11.000000000 +0100 +++ /var/tmp/diff_new_pack.hG3Nxf/_new 2009-11-02 22:27:11.000000000 +0100 @@ -20,7 +20,7 @@ Name: preload Version: 1.1 -Release: 6 +Release: 7 Summary: Preloads Files into System Cache for Faster Booting License: GPL v2 or later Group: System/Boot ++++++ preload.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/preload/preload.c new/preload/preload.c --- old/preload/preload.c 2009-10-06 18:08:04.000000000 +0200 +++ new/preload/preload.c 2009-11-02 17:44:07.000000000 +0100 @@ -90,6 +90,7 @@ command_alloced += 128; all_commands = realloc (all_commands, command_alloced * sizeof (all_commands[0])); + memset (&all_commands[command_alloced - 128], 0, 128 * sizeof (all_commands[0])); } static void open_file (const char *name, unsigned int idx) @@ -468,57 +469,70 @@ static void *worker_thread(void *ptr) { unsigned int idx; - unsigned int todo_idx = 0; for (idx = 0; idx < command_counter;) { if (todo_queue_size > 0) { - int queue, min_queue = -1; + int queue, min_queue = 0; unsigned int min_cmd = command_counter + 1; pthread_mutex_lock(&eqm); for (queue = 0; queue < todo_queue_size; ++queue) { int process = todo_queue[queue]; - unsigned int *commands = all_processes[process].commands; - while (commands[all_processes[process].command_index] <= idx && - all_processes[process].command_index < all_processes[process].command_count ) - all_processes[process].command_index++; - if (min_cmd > commands[all_processes[process].command_index]) + struct process *P = all_processes + process; + unsigned int *commands = P->commands; + while ((P->command_index < P->command_count) + && commands[P->command_index] <= idx) + P->command_index++; + if (P->command_index >= P->command_count) { - min_cmd = commands[all_processes[process].command_index]; + if (min_cmd == command_counter + 1) + min_queue = queue; + } + else if (min_cmd > commands[P->command_index]) + { + min_cmd = commands[P->command_index]; min_queue = queue; } } - if (min_queue != -1) + //fprintf(stderr, "min %d %d %d\n", min_cmd, min_queue, todo_queue_fd[min_queue]); + if (min_cmd != command_counter + 1) { - //fprintf(stderr, "min %d %d %d\n", min_cmd, min_queue, todo_queue_fd[min_queue]); do_command(min_cmd); all_processes[todo_queue[min_queue]].command_index++; - - if (all_processes[todo_queue[min_queue]].command_index >= - all_processes[todo_queue[min_queue]].command_count) + } + + if (all_processes[todo_queue[min_queue]].command_index >= + all_processes[todo_queue[min_queue]].command_count) + { + int s2 = todo_queue_fd[min_queue], i; + //printf("finished %d\n", s2); + send(s2, "ok", 2, 0); + close(s2); + for (i = min_queue+1; i < todo_queue_size; ++i) { - int s2 = todo_queue_fd[min_queue], i; - //printf("finished %d\n", s2); - send(s2, "ok", 2, 0); - close(s2); - for (i = min_queue+1; i < todo_queue_size; ++i) - { - todo_queue[i-1] = todo_queue[i]; - todo_queue_fd[i-1] = todo_queue_fd[i]; - } - todo_queue_size--; + todo_queue[i-1] = todo_queue[i]; + todo_queue_fd[i-1] = todo_queue_fd[i]; } + todo_queue_size--; } pthread_mutex_unlock(&eqm); // give free the main thread - } else { - todo_idx = 0; - do_command(idx++); - } + } + else + { + do_command(idx++); + } } - if (verbose) printf("unlink\n"); + if (verbose) + { + printf ("Loaded %zd bytes\n", total_bytes); + printf ("Stated %zd entries\n", total_stats); + printf("unlinked sun\n"); + } + free(all_processes); + free(all_commands); unlink("/dev/shm/preload_sock"); exit(0); } @@ -660,12 +674,6 @@ continue; } - if (verbose) - { - printf ("Loaded %zd bytes\n", total_bytes); - printf ("Stated %zd entries\n", total_stats); - printf("unlinked sun\n"); - } unlink(local.sun_path); return 0; } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de