]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: dynbuf: use the b_queue()/b_requeue() functions everywhere
authorWilly Tarreau <w@1wt.eu>
Wed, 24 Apr 2024 15:02:23 +0000 (17:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 May 2024 15:18:13 +0000 (17:18 +0200)
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.

include/haproxy/applet.h
include/haproxy/channel.h
src/check.c
src/flt_spoe.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c

index baa64028487d58388fd34e40dfba0e8d2ee361da..953e13cb708e7bac65ec112afbc7307019e94039 100644 (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;
 }
index 54f1e297cee064c277f7568d840386cbcd554729..6e0c35bc75b908d6144145f7fa0be3f91e7bfe29 100644 (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;
 }
 
index 3a72b0c3dc2e82490e31fc5342661d11d4bf1fe9..d00ea265a8e818c9a8aa096ea63055d4c0038e5b 100644 (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;
 }
index 562e7c36fd77c5b8d51b930bfe2e942548451073..f8718f01a544c3cc84aecce60af0447a59d78183 100644 (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;
 }
 
index 71609532f7306317888f47a37e9136278f22cabe..e8a71905456678ea7beda6826ee90553fcaa9ce7 100644 (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;
 }
index a886c00c3c10e86732621cfbad66da769be4ef97..4839e432eb93083a4f0f7161e7a18ad0dc81104d 100644 (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;
 }
index 28dd457df6ff6f58aa9c4372cd729e3cf5f96d68..9f2bef246c230e65bfc349eb33a35f146550d69a 100644 (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;
 }