]> wimlib.net Git - wimlib/commitdiff
Multithreaded stream write: Fix progress function calls
authorEric Biggers <ebiggers3@gmail.com>
Mon, 8 Apr 2013 15:24:31 +0000 (10:24 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 8 Apr 2013 15:24:31 +0000 (10:24 -0500)
src/lookup_table.h
src/write.c

index a5e4826116098f1cf2e1b3044bcc04f0f515b806..e5241f8068498ce0504145589551c8cffd8b57b8 100644 (file)
@@ -146,6 +146,8 @@ struct wim_lookup_table_entry {
        
        u8 deferred : 1;
 
        
        u8 deferred : 1;
 
+       u8 no_progress : 1;
+
        /* (On-disk field)
         * Number of times this lookup table entry is referenced by dentries.
         * Unfortunately, this field is not always set correctly in Microsoft's
        /* (On-disk field)
         * Number of times this lookup table entry is referenced by dentries.
         * Unfortunately, this field is not always set correctly in Microsoft's
index e0d898eea3c516ebb3a2f2b69a645a76dd3802af..b4d0f0d7d891b372f0f383a82a9466990a5d69ee 100644 (file)
@@ -681,6 +681,7 @@ do_write_stream_list(struct list_head *stream_list,
                                         * just skip to the next stream. */
                                        DEBUG("Discarding duplicate stream of length %"PRIu64,
                                              wim_resource_size(lte));
                                         * just skip to the next stream. */
                                        DEBUG("Discarding duplicate stream of length %"PRIu64,
                                              wim_resource_size(lte));
+                                       lte->no_progress = 0;
                                        goto skip_to_progress;
                                }
                        }
                                        goto skip_to_progress;
                                }
                        }
@@ -695,6 +696,7 @@ do_write_stream_list(struct list_head *stream_list,
                 * the SHA1 message digest yet.  */
                wimlib_assert(lte->out_refcnt != 0);
                lte->deferred = 0;
                 * the SHA1 message digest yet.  */
                wimlib_assert(lte->out_refcnt != 0);
                lte->deferred = 0;
+               lte->no_progress = 0;
                ret = (*write_stream_cb)(lte, write_stream_ctx);
                if (ret)
                        break;
                ret = (*write_stream_cb)(lte, write_stream_ctx);
                if (ret)
                        break;
@@ -708,7 +710,7 @@ do_write_stream_list(struct list_head *stream_list,
                        lte->unhashed = 0;
                }
        skip_to_progress:
                        lte->unhashed = 0;
                }
        skip_to_progress:
-               if (progress_func) {
+               if (!lte->no_progress) {
                        do_write_streams_progress(progress,
                                                  progress_func,
                                                  wim_resource_size(lte));
                        do_write_streams_progress(progress,
                                                  progress_func,
                                                  wim_resource_size(lte));
@@ -1185,6 +1187,7 @@ main_thread_process_next_stream(struct wim_lookup_table_entry *lte, void *_ctx)
        } else {
                ret = submit_stream_for_compression(lte, ctx);
        }
        } else {
                ret = submit_stream_for_compression(lte, ctx);
        }
+       lte->no_progress = 1;
        return ret;
 }
 
        return ret;
 }
 
@@ -1313,7 +1316,7 @@ write_stream_list_parallel(struct list_head *stream_list,
                goto out_join;
        ret = do_write_stream_list(stream_list, lookup_table,
                                   main_thread_process_next_stream,
                goto out_join;
        ret = do_write_stream_list(stream_list, lookup_table,
                                   main_thread_process_next_stream,
-                                  &ctx, NULL, NULL);
+                                  &ctx, progress_func, progress);
        if (ret)
                goto out_destroy_ctx;
 
        if (ret)
                goto out_destroy_ctx;