summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeremy Condra <gcondra@google.com>2014-04-08 20:47:59 -0700
committerGeremy Condra <gcondra@google.com>2014-04-08 20:47:59 -0700
commitf36f1d5487401f5478786a1e1ef051c6aaa90098 (patch)
tree0c9c387586b0a0008b91806a6229c8b8e1ff62ac
parentd92658ddf89ca3525412bf3becb7e98bedb6fc8b (diff)
downloadsyspatch-f36f1d5487401f5478786a1e1ef051c6aaa90098.tar.gz
Don't increment the window count for 0-length windows.
These windows should be consumed like any others, but should not be added to the window count or the write queue. This issue does not cause frontier violations per se, but does contribute to the problem by shortening the effective length of the write queue. This is particularly noticable in- but not unique to- the situation where you have a read cache shorter than one full source window. Change-Id: Iba9739b9a82b60bcd7029652fe3bb6c4d2892eca
-rw-r--r--syspatch.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/syspatch.c b/syspatch.c
index 96187a7..c4a0408 100644
--- a/syspatch.c
+++ b/syspatch.c
@@ -196,11 +196,13 @@ static int stream_to_target_write(xd3_stream *stream, TargetWrite *tgt) {
static int advance_target_buffer(xd3_stream *stream, MapState *target_state) {
TargetWrite *tgt = WRITE_QUEUE[TARGET_WINDOWS_WRITTEN % WRITE_QUEUE_LENGTH];
- if (write_target(tgt, target_state) != 0)
- return -1;
+ if (tgt->length) {
+ if (write_target(tgt, target_state) != 0)
+ return -1;
+ TARGET_WINDOWS_WRITTEN += 1;
+ }
if (stream_to_target_write(stream, tgt) != 0)
return -1;
- TARGET_WINDOWS_WRITTEN += 1;
return 0;
}