Commit f7f0af00 authored by Nils Goroll's avatar Nils Goroll

move pecx members where they belong

parent fc5d0d65
...@@ -276,6 +276,9 @@ struct pesi_tree { ...@@ -276,6 +276,9 @@ struct pesi_tree {
/* /*
* per request state * per request state
* *
* pecx: ESI parser
* pesi: any request
*
*/ */
struct pecx { struct pecx {
unsigned magic; unsigned magic;
...@@ -283,12 +286,8 @@ struct pecx { ...@@ -283,12 +286,8 @@ struct pecx {
const uint8_t *p; const uint8_t *p;
const uint8_t *e; const uint8_t *e;
struct worker *wrk;
struct node *node;
ssize_t l; ssize_t l;
int state; int state;
int woken;
}; };
struct pesi { struct pesi {
...@@ -297,6 +296,10 @@ struct pesi { ...@@ -297,6 +296,10 @@ struct pesi {
unsigned has_task:1; unsigned has_task:1;
struct pesi_tree *pesi_tree; struct pesi_tree *pesi_tree;
struct worker *wrk;
struct node *node;
int woken;
struct pecx pecx[1]; struct pecx pecx[1];
VTAILQ_ENTRY(pesi) list; VTAILQ_ENTRY(pesi) list;
}; };
...@@ -936,8 +939,8 @@ ved_task(struct worker *wrk, void *priv) ...@@ -936,8 +939,8 @@ ved_task(struct worker *wrk, void *priv)
CHECK_OBJ_NOTNULL(pesi_tree, PESI_TREE_MAGIC); CHECK_OBJ_NOTNULL(pesi_tree, PESI_TREE_MAGIC);
pecx = pesi->pecx; pecx = pesi->pecx;
CHECK_OBJ_NOTNULL(pecx, PECX_MAGIC); CHECK_OBJ_NOTNULL(pecx, PECX_MAGIC);
pecx->wrk = wrk; pesi->wrk = wrk;
node = pecx->node; node = pesi->node;
CHECK_OBJ_NOTNULL(node, NODE_MAGIC); CHECK_OBJ_NOTNULL(node, NODE_MAGIC);
CHECK_OBJ_NOTNULL(pesi_tree->tree, BYTES_TREE_MAGIC); CHECK_OBJ_NOTNULL(pesi_tree->tree, BYTES_TREE_MAGIC);
...@@ -962,7 +965,7 @@ ved_task(struct worker *wrk, void *priv) ...@@ -962,7 +965,7 @@ ved_task(struct worker *wrk, void *priv)
while (1) { while (1) {
req->wrk = wrk; req->wrk = wrk;
pecx->woken = 0; pesi->woken = 0;
VSLdbgv(req, "Starting CNT_Request() req=%p", req); VSLdbgv(req, "Starting CNT_Request() req=%p", req);
s = CNT_Request(req); s = CNT_Request(req);
VSLdbgv(req, "CNT_Request()=%d req=%p", s, req); VSLdbgv(req, "CNT_Request()=%d req=%p", s, req);
...@@ -972,14 +975,14 @@ ved_task(struct worker *wrk, void *priv) ...@@ -972,14 +975,14 @@ ved_task(struct worker *wrk, void *priv)
"loop waiting for ESI (%d)", (int)s); "loop waiting for ESI (%d)", (int)s);
assert(s == REQ_FSM_DISEMBARK); assert(s == REQ_FSM_DISEMBARK);
Lck_Lock(&req->sp->mtx); Lck_Lock(&req->sp->mtx);
if (!pecx->woken) { if (!pesi->woken) {
VSLb(req->vsl, SLT_Debug, "Waiting for busyobj"); VSLb(req->vsl, SLT_Debug, "Waiting for busyobj");
(void)Lck_CondWait( (void)Lck_CondWait(
&wrk->cond, &req->sp->mtx, 0); &wrk->cond, &req->sp->mtx, 0);
VSLb(req->vsl, SLT_Debug, "busyobj wakeup"); VSLb(req->vsl, SLT_Debug, "busyobj wakeup");
} }
Lck_Unlock(&req->sp->mtx); Lck_Unlock(&req->sp->mtx);
pecx->woken = 0; pesi->woken = 0;
AZ(req->wrk); AZ(req->wrk);
VSLdbg(req, "Calling CNT_Embark()"); VSLdbg(req, "Calling CNT_Embark()");
CNT_Embark(wrk, req); CNT_Embark(wrk, req);
...@@ -1221,7 +1224,7 @@ vped_include(struct req *preq, const char *src, const char *host, ...@@ -1221,7 +1224,7 @@ vped_include(struct req *preq, const char *src, const char *host,
npecx = pesi2->pecx; npecx = pesi2->pecx;
AZ(npecx->state); AZ(npecx->state);
npecx->node = node; pesi2->node = node;
req->transport_priv = pesi2; req->transport_priv = pesi2;
...@@ -1903,7 +1906,7 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv, ...@@ -1903,7 +1906,7 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv,
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(pesi->pecx, PECX_MAGIC); CHECK_OBJ_NOTNULL(pesi->pecx, PECX_MAGIC);
parent = pesi->pecx->node; parent = pesi->node;
CHECK_OBJ_NOTNULL(parent, NODE_MAGIC); CHECK_OBJ_NOTNULL(parent, NODE_MAGIC);
assert(parent->type == T_NEXUS); assert(parent->type == T_NEXUS);
VSLdbgv(req, "bytes_add: parent=%p front=%p", VSLdbgv(req, "bytes_add: parent=%p front=%p",
...@@ -2171,9 +2174,9 @@ vdp_pesi_init(struct req *req, void **priv) ...@@ -2171,9 +2174,9 @@ vdp_pesi_init(struct req *req, void **priv)
AZ(pthread_cond_init(&pesi_tree->tree->cond, NULL)); AZ(pthread_cond_init(&pesi_tree->tree->cond, NULL));
AZ(pesi_tree->tree->retval); AZ(pesi_tree->tree->retval);
pecx->node = pesi_tree->tree->root; pesi->node = pesi_tree->tree->root;
AZ(pecx->state); AZ(pecx->state);
AZ(pecx->woken); AZ(pesi->woken);
VDP_Push(req, &VDP_pesi_buf, pesi); VDP_Push(req, &VDP_pesi_buf, pesi);
return (0); return (0);
...@@ -2203,7 +2206,7 @@ vdp_pesi_fini(struct req *req, void **priv) ...@@ -2203,7 +2206,7 @@ vdp_pesi_fini(struct req *req, void **priv)
// XXX turn assertion - can we close in vdp_pesi_bytes? // XXX turn assertion - can we close in vdp_pesi_bytes?
pecx = pesi->pecx; pecx = pesi->pecx;
CHECK_OBJ_NOTNULL(pecx, PECX_MAGIC); CHECK_OBJ_NOTNULL(pecx, PECX_MAGIC);
node = pecx->node; node = pesi->node;
CHECK_OBJ_NOTNULL(node, NODE_MAGIC); CHECK_OBJ_NOTNULL(node, NODE_MAGIC);
if (req->esi_level > 0) { if (req->esi_level > 0) {
...@@ -2296,7 +2299,7 @@ vdp_pesi_bytes(struct req *req, enum vdp_action act, void **priv, ...@@ -2296,7 +2299,7 @@ vdp_pesi_bytes(struct req *req, enum vdp_action act, void **priv,
pecx = pesi->pecx; pecx = pesi->pecx;
tree = pesi->pesi_tree->tree; tree = pesi->pesi_tree->tree;
node = pecx->node; node = pesi->node;
CHECK_OBJ_NOTNULL(node, NODE_MAGIC); CHECK_OBJ_NOTNULL(node, NODE_MAGIC);
/* /*
...@@ -2548,8 +2551,8 @@ vped_reembark(struct worker *wrk, struct req *req) ...@@ -2548,8 +2551,8 @@ vped_reembark(struct worker *wrk, struct req *req)
VSLb(req->vsl, SLT_Debug, "reembark wakeup"); VSLb(req->vsl, SLT_Debug, "reembark wakeup");
Lck_Lock(&req->sp->mtx); Lck_Lock(&req->sp->mtx);
pesi->pecx->woken = 1; pesi->woken = 1;
AZ(pthread_cond_signal(&pesi->pecx->wrk->cond)); AZ(pthread_cond_signal(&pesi->wrk->cond));
Lck_Unlock(&req->sp->mtx); Lck_Unlock(&req->sp->mtx);
} }
...@@ -2624,7 +2627,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody) ...@@ -2624,7 +2627,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
CHECK_OBJ_NOTNULL(pesi->pesi_tree->tree, BYTES_TREE_MAGIC); CHECK_OBJ_NOTNULL(pesi->pesi_tree->tree, BYTES_TREE_MAGIC);
tree = pesi->pesi_tree->tree; tree = pesi->pesi_tree->tree;
node = pesi->pecx->node; node = pesi->node;
parent = node->parent; parent = node->parent;
CHECK_OBJ_NOTNULL(parent, NODE_MAGIC); CHECK_OBJ_NOTNULL(parent, NODE_MAGIC);
assert(parent->type == T_NEXUS); assert(parent->type == T_NEXUS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment