Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
4a918fa1
Commit
4a918fa1
authored
Aug 15, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move busyobj allocation into the VBF code.
parent
06df39d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
41 deletions
+28
-41
cache.h
bin/varnishd/cache/cache.h
+1
-1
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+16
-7
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+10
-32
c00012.vtc
bin/varnishtest/tests/c00012.vtc
+1
-1
No files found.
bin/varnishd/cache/cache.h
View file @
4a918fa1
...
...
@@ -838,7 +838,7 @@ int EXP_NukeOne(struct busyobj *, struct lru *lru);
void
EXP_NukeLRU
(
struct
worker
*
wrk
,
struct
vsl_log
*
vsl
,
struct
lru
*
lru
);
/* cache_fetch.c */
void
VBF_Fetch
(
struct
worker
*
wrk
,
struct
req
*
req
);
struct
busyobj
*
VBF_Fetch
(
struct
worker
*
wrk
,
struct
req
*
req
,
struct
objcore
*
oc
,
int
pass
);
/* cache_fetch_proc.c */
struct
storage
*
VFP_GetStorage
(
struct
busyobj
*
,
ssize_t
sz
);
...
...
bin/varnishd/cache/cache_fetch.c
View file @
4a918fa1
...
...
@@ -506,23 +506,31 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
/*--------------------------------------------------------------------
*/
void
VBF_Fetch
(
struct
worker
*
wrk
,
struct
req
*
req
)
struct
busyobj
*
VBF_Fetch
(
struct
worker
*
wrk
,
struct
req
*
req
,
struct
objcore
*
oc
,
int
pass
)
{
struct
busyobj
*
bo
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
objcore
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
bo
=
req
->
busyobj
;
bo
=
VBO_GetBusyObj
(
wrk
,
req
)
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
assert
(
bo
->
refcount
==
2
);
bo
->
refcount
=
2
;
oc
->
busyobj
=
bo
;
assert
(
bo
->
refcount
>=
1
);
CHECK_OBJ_NOTNULL
(
bo
->
vcl
,
VCL_CONF_MAGIC
);
bo
->
do_pass
=
pass
;
bo
->
vary
=
req
->
vary_b
;
req
->
vary_b
=
NULL
;
AZ
(
bo
->
fetch_objcore
);
bo
->
fetch_objcore
=
req
->
objcore
;
req
->
objcore
=
NULL
;
bo
->
fetch_objcore
=
oc
;
AZ
(
bo
->
req
);
bo
->
req
=
req
;
...
...
@@ -536,4 +544,5 @@ VBF_Fetch(struct worker *wrk, struct req *req)
printf
(
"XXX
\n
"
);
(
void
)
usleep
(
100000
);
}
return
(
bo
);
}
bin/varnishd/cache/cache_req_fsm.c
View file @
4a918fa1
...
...
@@ -336,7 +336,7 @@ cnt_error(struct worker *wrk, struct req *req)
}
/*--------------------------------------------------------------------
*
Prepare to fetch body from backend
*
Initiated a fetch (pass/miss) which we intend to deliver
*
DOT subgraph xcluster_body {
DOT fetch [
...
...
@@ -355,12 +355,8 @@ cnt_fetch(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
AN
(
req
->
busyobj
);
AN
(
req
->
objcore
);
req
->
acct_req
.
fetch
++
;
VBF_Fetch
(
wrk
,
req
);
AN
(
req
->
busyobj
);
AZ
(
req
->
objcore
);
assert
(
req
->
busyobj
->
refcount
>
0
);
(
void
)
HTTP1_DiscardReqBody
(
req
);
while
(
req
->
busyobj
->
state
<
BOS_FAILED
)
{
...
...
@@ -555,7 +551,6 @@ DOT
static
enum
req_fsm_nxt
cnt_miss
(
struct
worker
*
wrk
,
struct
req
*
req
)
{
struct
busyobj
*
bo
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
...
...
@@ -564,32 +559,22 @@ cnt_miss(struct worker *wrk, struct req *req)
AZ
(
req
->
obj
);
AZ
(
req
->
busyobj
);
/*
* We optimistically expect to need this most of the time
* (This allows us to put the predictive Vary directly on the bo->ws)
*/
bo
=
VBO_GetBusyObj
(
wrk
,
req
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
req
->
busyobj
=
bo
;
bo
->
vary
=
req
->
vary_b
;
req
->
vary_b
=
NULL
;
VCL_miss_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
switch
(
wrk
->
handling
)
{
case
VCL_RET_ERROR
:
VBO_DerefBusyObj
(
wrk
,
&
req
->
busyobj
);
free
(
req
->
vary_b
);
AZ
(
HSH_Deref
(
&
wrk
->
stats
,
req
->
objcore
,
NULL
));
req
->
objcore
=
NULL
;
req
->
req_step
=
R_STP_ERROR
;
return
(
REQ_FSM_MORE
);
case
VCL_RET_RESTART
:
VBO_DerefBusyObj
(
wrk
,
&
req
->
busyobj
);
free
(
req
->
vary_b
);
AZ
(
HSH_Deref
(
&
wrk
->
stats
,
req
->
objcore
,
NULL
));
req
->
objcore
=
NULL
;
req
->
req_step
=
R_STP_RESTART
;
return
(
REQ_FSM_MORE
);
case
VCL_RET_PASS
:
VBO_DerefBusyObj
(
wrk
,
&
req
->
busyobj
);
free
(
req
->
vary_b
);
AZ
(
HSH_Deref
(
&
wrk
->
stats
,
req
->
objcore
,
NULL
));
req
->
objcore
=
NULL
;
req
->
req_step
=
R_STP_PASS
;
...
...
@@ -600,13 +585,11 @@ cnt_miss(struct worker *wrk, struct req *req)
WRONG
(
"wrong return from vcl_miss{}"
);
}
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AN
(
req
->
objcore
);
wrk
->
stats
.
cache_miss
++
;
req
->
objcore
->
busyobj
=
bo
;
bo
->
refcount
=
2
;
/* One ref for req, one for vbf_fetch_body */
AN
(
req
->
objcore
);
req
->
busyobj
=
VBF_Fetch
(
wrk
,
req
,
req
->
objcore
,
0
);
req
->
objcore
=
NULL
;
req
->
req_step
=
R_STP_FETCH
;
return
(
REQ_FSM_MORE
);
}
...
...
@@ -631,7 +614,6 @@ XDOT err_pass [label="ERROR",shape=plaintext]
static
enum
req_fsm_nxt
cnt_pass
(
struct
worker
*
wrk
,
struct
req
*
req
)
{
struct
busyobj
*
bo
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
...
...
@@ -651,14 +633,10 @@ cnt_pass(struct worker *wrk, struct req *req)
assert
(
wrk
->
handling
==
VCL_RET_FETCH
);
req
->
acct_req
.
pass
++
;
bo
=
VBO_GetBusyObj
(
wrk
,
req
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
req
->
busyobj
=
bo
;
bo
->
do_pass
=
1
;
req
->
objcore
=
HSH_NewObjCore
(
wrk
);
req
->
objcore
->
busyobj
=
bo
;
bo
->
refcount
=
2
;
/* One ref for req, one for vbf_fetch_body */
AN
(
req
->
objcore
);
req
->
busyobj
=
VBF_Fetch
(
wrk
,
req
,
req
->
objcore
,
1
)
;
req
->
objcore
=
NULL
;
req
->
req_step
=
R_STP_FETCH
;
return
(
REQ_FSM_MORE
);
}
...
...
bin/varnishtest/tests/c00012.vtc
View file @
4a918fa1
...
...
@@ -25,7 +25,7 @@ client c1 {
rxresp
expect resp.status == 200
expect resp.bodylen == 7
expect resp.http.x-varnish == "100
4
"
expect resp.http.x-varnish == "100
3
"
}
client c1 -run
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