return b_requeue(crit, bw);
}
+/* Dequeues bw element <bw> from its list and updates the bufq_map if if was
+ * the last element. All users of buffer_wait should use this to dequeue (e.g.
+ * when killing a pending request on timeout) so as to make sure that we keep
+ * consistency between the list heads and the bitmap.
+ */
+static inline void b_dequeue(struct buffer_wait *bw)
+{
+ uint q;
+
+ if (likely(!LIST_INLIST(&bw->list)))
+ return;
+
+ /* trick: detect if we're the last one and pointing to a root, so we
+ * can figure the queue number since the root belongs to an array.
+ */
+ if (LIST_ATMOST1(&bw->list)) {
+ /* OK then which root? */
+ q = bw->list.n - &th_ctx->buffer_wq[0];
+ BUG_ON_HOT(q >= DYNBUF_NBQ);
+ th_ctx->bufq_map &= ~(1 << q);
+ }
+ LIST_DEL_INIT(&bw->list);
+}
#endif /* _HAPROXY_DYNBUF_H */