From 5a38ee4a131d881d97c189616a63cf0a12272756 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 14 Jan 2010 22:58:54 +0100 Subject: [PATCH] [btr] Fix btr_get_input_queue_size(). We must take care of wrap buffers when computing the input queue size. --- buffer_tree.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/buffer_tree.c b/buffer_tree.c index e023bb14..57f1398e 100644 --- a/buffer_tree.c +++ b/buffer_tree.c @@ -491,12 +491,17 @@ void btr_remove_node(struct btr_node *btrn) size_t btr_get_input_queue_size(struct btr_node *btrn) { struct btr_buffer_reference *br; - size_t size = 0; + size_t size = 0, wrap_consumed = 0; FOR_EACH_BUFFER_REF(br, btrn) { - //PARA_CRIT_LOG("size: %zu\n", size); + if (br->wrap_count != 0) { + wrap_consumed = br->consumed; + continue; + } size += br_available_bytes(br); } + assert(wrap_consumed <= size); + size -= wrap_consumed; return size; } -- 2.39.5