diff options
author | Geremy Condra <gcondra@google.com> | 2014-04-08 20:47:59 -0700 |
---|---|---|
committer | Geremy Condra <gcondra@google.com> | 2014-04-08 20:47:59 -0700 |
commit | f36f1d5487401f5478786a1e1ef051c6aaa90098 (patch) | |
tree | 0c9c387586b0a0008b91806a6229c8b8e1ff62ac | |
parent | d92658ddf89ca3525412bf3becb7e98bedb6fc8b (diff) | |
download | syspatch-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.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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; } |