Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdp-pesi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
uplex-varnish
libvdp-pesi
Commits
4ea75dc8
Commit
4ea75dc8
authored
Jul 31, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move req pointer to nexus to clarify who owns it
parent
adb0e53c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
19 deletions
+22
-19
vdp_pesi.c
src/vdp_pesi.c
+22
-19
No files found.
src/vdp_pesi.c
View file @
4ea75dc8
...
@@ -160,6 +160,7 @@ VSTAILQ_HEAD(node_head, node);
...
@@ -160,6 +160,7 @@ VSTAILQ_HEAD(node_head, node);
struct
node_nexus
{
struct
node_nexus
{
struct
node_head
children
;
struct
node_head
children
;
struct
objcore
*
oc
;
struct
objcore
*
oc
;
struct
req
*
req
;
/* number of nodes pending under this node while state == ST_PRIVATE */
/* number of nodes pending under this node while state == ST_PRIVATE */
int
npending_private
;
int
npending_private
;
/*
/*
...
@@ -202,7 +203,7 @@ struct node_subreq {
...
@@ -202,7 +203,7 @@ struct node_subreq {
pthread_cond_t
cond
;
pthread_cond_t
cond
;
};
};
//
XXX integrate with n_state?
//
sub-state for node_final while in ST_DATA
enum
fi_state
{
enum
fi_state
{
FI_READY
=
0
,
FI_READY
=
0
,
FI_GO
,
// topreq signalling req to deliver
FI_GO
,
// topreq signalling req to deliver
...
@@ -227,9 +228,6 @@ struct node {
...
@@ -227,9 +228,6 @@ struct node {
VSTAILQ_ENTRY
(
node
)
unpend
;
VSTAILQ_ENTRY
(
node
)
unpend
;
struct
node
*
parent
;
struct
node
*
parent
;
// XXX (re)move me: the req from vdp_bytes()
struct
req
*
req
;
union
{
union
{
struct
node_nexus
nexus
;
// T_NEXUS
struct
node_nexus
nexus
;
// T_NEXUS
struct
node_data
data
;
// T_DATA
struct
node_data
data
;
// T_DATA
...
@@ -508,7 +506,7 @@ node_fini(struct req *req, struct node *node)
...
@@ -508,7 +506,7 @@ node_fini(struct req *req, struct node *node)
/* root req owned by varnish-cache */
/* root req owned by varnish-cache */
if
(
node
->
parent
==
NULL
)
if
(
node
->
parent
==
NULL
)
break
;
break
;
req_fini
(
&
node
->
req
,
req
->
wrk
);
req_fini
(
&
node
->
nexus
.
req
,
req
->
wrk
);
break
;
break
;
default:
default:
INCOMPL
();
INCOMPL
();
...
@@ -797,7 +795,7 @@ set_delivered(struct bytes_tree *tree, struct node *node)
...
@@ -797,7 +795,7 @@ set_delivered(struct bytes_tree *tree, struct node *node)
if
(
node
->
type
==
T_NEXUS
&&
if
(
node
->
type
==
T_NEXUS
&&
node
->
nexus
.
oc
!=
NULL
)
{
node
->
nexus
.
oc
!=
NULL
)
{
req
=
tree
->
root
->
req
;
req
=
tree
->
root
->
nexus
.
req
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
wrk
,
WORKER_MAGIC
);
...
@@ -1010,7 +1008,7 @@ ved_task(struct worker *wrk, void *priv)
...
@@ -1010,7 +1008,7 @@ ved_task(struct worker *wrk, void *priv)
Lck_Unlock
(
&
pesi_tree
->
tree
->
tree_lock
);
Lck_Unlock
(
&
pesi_tree
->
tree
->
tree_lock
);
break
;
break
;
case
T_NEXUS
:
case
T_NEXUS
:
assert
(
node
->
req
==
req
);
assert
(
node
->
nexus
.
req
==
req
);
assert
(
node
->
state
==
ST_OPEN
||
assert
(
node
->
state
==
ST_OPEN
||
node
->
state
==
ST_PRIVATE
);
node
->
state
==
ST_PRIVATE
);
...
@@ -1054,10 +1052,10 @@ ved_task(struct worker *wrk, void *priv)
...
@@ -1054,10 +1052,10 @@ ved_task(struct worker *wrk, void *priv)
if
(
pesi
)
if
(
pesi
)
pesi_destroy
(
&
pesi
);
pesi_destroy
(
&
pesi
);
assert
(
req
==
node
->
req
);
assert
(
req
==
node
->
nexus
.
req
);
req
=
NULL
;
req
=
NULL
;
req_fini
(
&
node
->
req
,
wrk
);
req_fini
(
&
node
->
nexus
.
req
,
wrk
);
/* turn into T_DATA node */
/* turn into T_DATA node */
node_mutate_prep
(
pesi_tree
->
tree
,
node
);
node_mutate_prep
(
pesi_tree
->
tree
,
node
);
...
@@ -1230,7 +1228,7 @@ vped_include(struct req *preq, const char *src, const char *host,
...
@@ -1230,7 +1228,7 @@ vped_include(struct req *preq, const char *src, const char *host,
req
->
ws_req
=
WS_Snapshot
(
req
->
ws
);
req
->
ws_req
=
WS_Snapshot
(
req
->
ws
);
assert
(
node
->
type
==
T_NEXUS
);
assert
(
node
->
type
==
T_NEXUS
);
node
->
req
=
req
;
node
->
nexus
.
req
=
req
;
VSLdbgv
(
preq
,
"ved_include: attempt new thread req=%p"
,
req
);
VSLdbgv
(
preq
,
"ved_include: attempt new thread req=%p"
,
req
);
...
@@ -1347,7 +1345,7 @@ bytes_unpend_worklist(struct req *req, struct bytes_tree *tree,
...
@@ -1347,7 +1345,7 @@ bytes_unpend_worklist(struct req *req, struct bytes_tree *tree,
CHECK_OBJ_NOTNULL
(
tree
->
front
,
NODE_MAGIC
);
CHECK_OBJ_NOTNULL
(
tree
->
front
,
NODE_MAGIC
);
CHECK_OBJ_NOTNULL
(
tree
->
root
,
NODE_MAGIC
);
CHECK_OBJ_NOTNULL
(
tree
->
root
,
NODE_MAGIC
);
assert
(
req
==
tree
->
root
->
req
);
assert
(
req
==
tree
->
root
->
nexus
.
req
);
assert
(
req
->
esi_level
==
0
);
assert
(
req
->
esi_level
==
0
);
...
@@ -1742,7 +1740,9 @@ push_data(struct req *req, struct bytes_tree *tree,
...
@@ -1742,7 +1740,9 @@ push_data(struct req *req, struct bytes_tree *tree,
}
}
assert
(
p
!=
gzip_fini
);
assert
(
p
!=
gzip_fini
);
return
(
VDP_bytes
(
node
->
req
,
act
,
p
,
node
->
data
.
len
));
AN
(
node
->
parent
);
assert
(
node
->
parent
->
type
==
T_NEXUS
);
return
(
VDP_bytes
(
node
->
parent
->
nexus
.
req
,
act
,
p
,
node
->
data
.
len
));
}
}
/*
/*
...
@@ -1905,16 +1905,18 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -1905,16 +1905,18 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv,
CHECK_OBJ_NOTNULL
(
pesi
->
pecx
,
PECX_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pecx
,
PECX_MAGIC
);
parent
=
pesi
->
pecx
->
node
;
parent
=
pesi
->
pecx
->
node
;
CHECK_OBJ_NOTNULL
(
parent
,
NODE_MAGIC
);
CHECK_OBJ_NOTNULL
(
parent
,
NODE_MAGIC
);
assert
(
parent
->
type
==
T_NEXUS
);
VSLdbgv
(
req
,
"bytes_add: parent=%p front=%p"
,
VSLdbgv
(
req
,
"bytes_add: parent=%p front=%p"
,
parent
,
tree
->
front
);
parent
,
tree
->
front
);
assert
(
req
==
parent
->
nexus
.
req
);
VSLdbg
(
req
,
"bytes_add: adding data to node"
);
VSLdbg
(
req
,
"bytes_add: adding data to node"
);
node
=
node_alloc
();
node
=
node_alloc
();
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
node
->
type
=
T_DATA
;
node
->
type
=
T_DATA
;
node
->
state
=
ST_DATA
;
node
->
state
=
ST_DATA
;
node
->
req
=
req
;
node
->
data
.
len
=
len
;
node
->
data
.
len
=
len
;
node
->
data
.
act
=
act
;
node
->
data
.
act
=
act
;
...
@@ -2159,9 +2161,9 @@ vdp_pesi_init(struct req *req, void **priv)
...
@@ -2159,9 +2161,9 @@ vdp_pesi_init(struct req *req, void **priv)
pesi_tree
->
tree
->
root
=
node_alloc
();
pesi_tree
->
tree
->
root
=
node_alloc
();
CHECK_OBJ_NOTNULL
(
pesi_tree
->
tree
->
root
,
NODE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi_tree
->
tree
->
root
,
NODE_MAGIC
);
pesi_tree
->
tree
->
front
=
pesi_tree
->
tree
->
root
;
pesi_tree
->
tree
->
front
=
pesi_tree
->
tree
->
root
;
pesi_tree
->
tree
->
root
->
req
=
req
;
pesi_tree
->
tree
->
root
->
state
=
ST_PRIVATE
;
pesi_tree
->
tree
->
root
->
state
=
ST_PRIVATE
;
pesi_tree
->
tree
->
root
->
type
=
T_NEXUS
;
pesi_tree
->
tree
->
root
->
type
=
T_NEXUS
;
pesi_tree
->
tree
->
root
->
nexus
.
req
=
req
;
pesi_tree
->
tree
->
root
->
nexus
.
gzip
.
magic
=
NEXUS_GZIP_MAGIC
;
pesi_tree
->
tree
->
root
->
nexus
.
gzip
.
magic
=
NEXUS_GZIP_MAGIC
;
VSTAILQ_INIT
(
&
pesi_tree
->
tree
->
root
->
nexus
.
children
);
VSTAILQ_INIT
(
&
pesi_tree
->
tree
->
root
->
nexus
.
children
);
Lck_New
(
&
pesi_tree
->
tree
->
tree_lock
,
lck_bytes_tree
);
Lck_New
(
&
pesi_tree
->
tree
->
tree_lock
,
lck_bytes_tree
);
...
@@ -2663,8 +2665,9 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
...
@@ -2663,8 +2665,9 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
VDP_Push
(
req
,
&
VDP_pesi_buf
,
pesi
);
VDP_Push
(
req
,
&
VDP_pesi_buf
,
pesi
);
AN
(
parent
);
AN
(
parent
);
XXXAZ
(
push_vdps
(
req
,
&
parent
->
nexus
.
gzip
));
assert
(
parent
->
type
==
T_NEXUS
);
AZ
(
VDP_Push
(
req
,
&
vped_to_parent
,
parent
->
req
));
AZ
(
push_vdps
(
req
,
&
parent
->
nexus
.
gzip
));
AZ
(
VDP_Push
(
req
,
&
vped_to_parent
,
parent
->
nexus
.
req
));
(
void
)
VDP_DeliverObj
(
req
);
(
void
)
VDP_DeliverObj
(
req
);
...
@@ -2678,7 +2681,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
...
@@ -2678,7 +2681,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
VSLdbg
(
req
,
"vped_deliver: T_FINAL"
);
VSLdbg
(
req
,
"vped_deliver: T_FINAL"
);
AZ
(
push_vdps
(
req
,
&
parent
->
nexus
.
gzip
));
AZ
(
push_vdps
(
req
,
&
parent
->
nexus
.
gzip
));
AZ
(
VDP_Push
(
req
,
&
vped_to_parent
,
parent
->
req
));
AZ
(
VDP_Push
(
req
,
&
vped_to_parent
,
parent
->
nexus
.
req
));
node_mutate_prep
(
tree
,
node
);
node_mutate_prep
(
tree
,
node
);
...
@@ -2718,7 +2721,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
...
@@ -2718,7 +2721,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
AZ
(
req
->
objcore
->
flags
&
OC_F_FINAL
);
AZ
(
req
->
objcore
->
flags
&
OC_F_FINAL
);
AZ
(
push_vdps
(
req
,
&
parent
->
nexus
.
gzip
));
AZ
(
push_vdps
(
req
,
&
parent
->
nexus
.
gzip
));
AZ
(
VDP_Push
(
req
,
&
vped_to_parent
,
parent
->
req
));
AZ
(
VDP_Push
(
req
,
&
vped_to_parent
,
parent
->
nexus
.
req
));
node_mutate_prep
(
tree
,
node
);
node_mutate_prep
(
tree
,
node
);
...
@@ -2752,7 +2755,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
...
@@ -2752,7 +2755,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
VDP_Push
(
req
,
&
VDP_pesi_buf
,
pesi
);
VDP_Push
(
req
,
&
VDP_pesi_buf
,
pesi
);
AZ
(
push_vdps
(
req
,
&
parent
->
nexus
.
gzip
));
AZ
(
push_vdps
(
req
,
&
parent
->
nexus
.
gzip
));
AN
(
parent
);
AN
(
parent
);
AZ
(
VDP_Push
(
req
,
&
vped_to_parent
,
parent
->
req
));
AZ
(
VDP_Push
(
req
,
&
vped_to_parent
,
parent
->
nexus
.
req
));
(
void
)
VDP_DeliverObj
(
req
);
(
void
)
VDP_DeliverObj
(
req
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment