42 static uint32_t flow_spare_pool_flow_cnt = 0;
50 size = flow_spare_pool_flow_cnt;
77 static void Validate(
FlowSparePool *top,
const uint32_t target)
94 assert(
cnt == target);
101 if (flow_spare_pool == NULL) {
102 flow_spare_pool = FlowSpareGetPool();
110 p->
next = flow_spare_pool;
115 flow_spare_pool_flow_cnt++;
127 flow_spare_pool_flow_cnt += fqp->
len;
128 if (flow_spare_pool != NULL) {
134 flow_spare_pool->
next = p;
137 p->
next = flow_spare_pool;
150 p->
next = flow_spare_pool;
154 flow_spare_pool->
next = p;
160 p->
next = flow_spare_pool;
176 if (flow_spare_pool == NULL || flow_spare_pool_flow_cnt == 0) {
185 flow_spare_pool = p->
next;
187 flow_spare_pool_flow_cnt -= p->
queue.
len;
189 Validate(flow_spare_pool, flow_spare_pool_flow_cnt);
197 }
else if (flow_spare_pool->
next != NULL) {
201 flow_spare_pool_flow_cnt -= p->
queue.
len;
203 Validate(flow_spare_pool, flow_spare_pool_flow_cnt);
221 uint32_t to_remove = (uint32_t)(todo * -1) / 10;
230 flow_spare_pool = p->
next;
231 flow_spare_pool_flow_cnt -= p->
queue.
len;
244 }
else if (todo > 0) {
249 uint32_t flow_cnt = 0;
250 for (uint32_t
cnt = 0;
cnt < blocks;
cnt++) {
255 const bool ok = FlowSparePoolUpdateBlock(p);
272 if (flow_spare_pool == NULL) {
273 flow_spare_pool =
head;
274 }
else if (
tail != NULL) {
282 flow_spare_pool_flow_cnt += flow_cnt;
284 Validate(flow_spare_pool, flow_spare_pool_flow_cnt);
299 FlowSparePoolUpdateBlock(p);
303 p->
next = flow_spare_pool;
305 flow_spare_pool_flow_cnt =
cnt;
320 flow_spare_pool_flow_cnt -=
cnt;
325 flow_spare_pool = NULL;