We must take care of wrap buffers when computing the input queue size.
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;
}