MINOR: dynbuf: use the b_queue()/b_requeue() functions everywhere

The code places that were used to manipulate the buffer_wq manually
now just call b_queue() or b_requeue(). This will simplify the multiple
list management later.
This commit is contained in:
Willy Tarreau 2024-04-24 17:02:23 +02:00
parent d1c2f325a2
commit a214197ce7
7 changed files with 8 additions and 20 deletions

View File

@ -91,10 +91,8 @@ static inline struct buffer *appctx_get_buf(struct appctx *appctx, struct buffer
struct buffer *buf = NULL;
if (likely(!LIST_INLIST(&appctx->buffer_wait.list)) &&
unlikely((buf = b_alloc(bptr, DB_CHANNEL)) == NULL)) {
appctx->buffer_wait.target = appctx;
appctx->buffer_wait.wakeup_cb = appctx_buf_available;
LIST_APPEND(&th_ctx->buffer_wq, &appctx->buffer_wait.list);
unlikely((buf = b_alloc(bptr, DB_SE_RX)) == NULL)) {
b_queue(DB_SE_RX, &appctx->buffer_wait, appctx, appctx_buf_available);
}
return buf;
}

View File

@ -918,9 +918,7 @@ static inline int channel_alloc_buffer(struct channel *chn, struct buffer_wait *
if (b_alloc(&chn->buf, DB_CHANNEL) != NULL)
return 1;
if (!LIST_INLIST(&wait->list))
LIST_APPEND(&th_ctx->buffer_wq, &wait->list);
b_requeue(DB_CHANNEL, wait);
return 0;
}

View File

@ -1530,9 +1530,7 @@ struct buffer *check_get_buf(struct check *check, struct buffer *bptr)
if (likely(!LIST_INLIST(&check->buf_wait.list)) &&
unlikely((buf = b_alloc(bptr, DB_CHANNEL)) == NULL)) {
check->buf_wait.target = check;
check->buf_wait.wakeup_cb = check_buf_available;
LIST_APPEND(&th_ctx->buffer_wq, &check->buf_wait.list);
b_queue(DB_CHANNEL, &check->buf_wait, check, check_buf_available);
}
return buf;
}

View File

@ -2858,7 +2858,7 @@ spoe_acquire_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
if (b_alloc(buf, DB_CHANNEL))
return 1;
LIST_APPEND(&th_ctx->buffer_wq, &buffer_wait->list);
b_requeue(DB_CHANNEL, buffer_wait);
return 0;
}

View File

@ -524,9 +524,7 @@ static inline struct buffer *fcgi_get_buf(struct fcgi_conn *fconn, struct buffer
if (likely(!LIST_INLIST(&fconn->buf_wait.list)) &&
unlikely((buf = b_alloc(bptr, DB_MUX_RX)) == NULL)) {
fconn->buf_wait.target = fconn;
fconn->buf_wait.wakeup_cb = fcgi_buf_available;
LIST_APPEND(&th_ctx->buffer_wq, &fconn->buf_wait.list);
b_queue(DB_MUX_RX, &fconn->buf_wait, fconn, fcgi_buf_available);
}
return buf;
}

View File

@ -536,9 +536,7 @@ static inline struct buffer *h1_get_buf(struct h1c *h1c, struct buffer *bptr)
if (likely(!LIST_INLIST(&h1c->buf_wait.list)) &&
unlikely((buf = b_alloc(bptr, DB_MUX_RX)) == NULL)) {
h1c->buf_wait.target = h1c;
h1c->buf_wait.wakeup_cb = h1_buf_available;
LIST_APPEND(&th_ctx->buffer_wq, &h1c->buf_wait.list);
b_queue(DB_MUX_RX, &h1c->buf_wait, h1c, h1_buf_available);
}
return buf;
}

View File

@ -845,9 +845,7 @@ static inline struct buffer *h2_get_buf(struct h2c *h2c, struct buffer *bptr)
if (likely(!LIST_INLIST(&h2c->buf_wait.list)) &&
unlikely((buf = b_alloc(bptr, DB_MUX_RX)) == NULL)) {
h2c->buf_wait.target = h2c;
h2c->buf_wait.wakeup_cb = h2_buf_available;
LIST_APPEND(&th_ctx->buffer_wq, &h2c->buf_wait.list);
b_queue(DB_MUX_RX, &h2c->buf_wait, h2c, h2_buf_available);
}
return buf;
}