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
b1f0b29e
Commit
b1f0b29e
authored
Feb 23, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't abuse OA_LEN to assemble the object, but set it once, and
only once, once we know it.
parent
85b8a22d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
14 deletions
+23
-14
cache.h
bin/varnishd/cache/cache.h
+3
-1
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+10
-3
cache_obj.c
bin/varnishd/cache/cache_obj.c
+8
-9
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+2
-1
No files found.
bin/varnishd/cache/cache.h
View file @
b1f0b29e
...
...
@@ -379,6 +379,7 @@ struct boc {
void
*
stevedore_priv
;
enum
boc_state_e
state
;
uint8_t
*
vary
;
uint64_t
len_so_far
;
};
/* Object core structure ---------------------------------------------
...
...
@@ -856,7 +857,8 @@ int ObjIterate(struct worker *, struct objcore *,
void
*
priv
,
objiterate_f
*
func
);
int
ObjGetSpace
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
*
sz
,
uint8_t
**
ptr
);
void
ObjExtend
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
l
);
uint64_t
ObjWaitExtend
(
struct
worker
*
,
struct
objcore
*
,
uint64_t
l
);
uint64_t
ObjWaitExtend
(
const
struct
worker
*
,
const
struct
objcore
*
,
uint64_t
l
);
void
ObjSetState
(
struct
worker
*
,
const
struct
objcore
*
,
enum
boc_state_e
next
);
void
ObjWaitState
(
const
struct
objcore
*
,
enum
boc_state_e
want
);
...
...
bin/varnishd/cache/cache_fetch.c
View file @
b1f0b29e
...
...
@@ -627,6 +627,8 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if
(
bo
->
htc
->
body_status
==
BS_NONE
)
bo
->
do_stream
=
0
;
bo
->
fetch_objcore
->
boc
->
len_so_far
=
0
;
if
(
VFP_Open
(
bo
->
vfc
))
{
(
void
)
VFP_Error
(
bo
->
vfc
,
"Fetch pipeline failed to open"
);
bo
->
htc
->
doclose
=
SC_RX_BODY
;
...
...
@@ -693,6 +695,9 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
}
}
AZ
(
ObjSetU64
(
wrk
,
bo
->
fetch_objcore
,
OA_LEN
,
bo
->
fetch_objcore
->
boc
->
len_so_far
));
if
(
bo
->
do_stream
)
assert
(
bo
->
fetch_objcore
->
boc
->
state
==
BOS_STREAM
);
else
{
...
...
@@ -726,8 +731,7 @@ vbf_objiterator(void *priv, int flush, const void *ptr, ssize_t len)
CAST_OBJ_NOTNULL
(
bo
,
priv
,
BUSYOBJ_MAGIC
);
while
(
len
>
0
)
{
l
=
ObjGetLen
(
bo
->
wrk
,
bo
->
stale_oc
);
assert
(
l
>
0
);
l
=
len
;
if
(
VFP_GetStorage
(
bo
->
vfc
,
&
l
,
&
pd
)
!=
VFP_OK
)
return
(
1
);
if
(
len
<
l
)
...
...
@@ -771,6 +775,9 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
return
(
F_STP_FAIL
);
}
AZ
(
ObjSetU64
(
wrk
,
bo
->
fetch_objcore
,
OA_LEN
,
bo
->
fetch_objcore
->
boc
->
len_so_far
));
if
(
!
bo
->
do_stream
)
HSH_Unbusy
(
wrk
,
bo
->
fetch_objcore
);
...
...
@@ -878,8 +885,8 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
ll
-=
l
;
o
+=
l
;
}
AZ
(
ObjSetU64
(
wrk
,
bo
->
fetch_objcore
,
OA_LEN
,
VSB_len
(
synth_body
)
-
ll
));
VSB_delete
(
synth_body
);
HSH_Unbusy
(
wrk
,
bo
->
fetch_objcore
);
ObjSetState
(
wrk
,
bo
->
fetch_objcore
,
BOS_FINISHED
);
return
(
F_STP_DONE
);
...
...
bin/varnishd/cache/cache_obj.c
View file @
b1f0b29e
...
...
@@ -175,19 +175,15 @@ void
ObjExtend
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
ssize_t
l
)
{
const
struct
obj_methods
*
om
=
obj_getmethods
(
oc
);
uint64_t
len
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
->
boc
,
BOC_MAGIC
);
assert
(
l
>
0
);
AZ
(
ObjGetU64
(
wrk
,
oc
,
OA_LEN
,
&
len
));
len
+=
l
;
Lck_Lock
(
&
oc
->
boc
->
mtx
);
AN
(
om
->
objextend
);
om
->
objextend
(
wrk
,
oc
,
l
);
AZ
(
ObjSetU64
(
wrk
,
oc
,
OA_LEN
,
len
))
;
oc
->
boc
->
len_so_far
+=
l
;
Lck_Unlock
(
&
oc
->
boc
->
mtx
);
AZ
(
pthread_cond_broadcast
(
&
oc
->
boc
->
cond
));
}
...
...
@@ -196,7 +192,7 @@ ObjExtend(struct worker *wrk, struct objcore *oc, ssize_t l)
*/
uint64_t
ObjWaitExtend
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
uint64_t
l
)
ObjWaitExtend
(
const
struct
worker
*
wrk
,
const
struct
objcore
*
oc
,
uint64_t
l
)
{
uint64_t
rv
;
...
...
@@ -204,14 +200,14 @@ ObjWaitExtend(struct worker *wrk, struct objcore *oc, uint64_t l)
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
->
boc
,
BOC_MAGIC
);
Lck_Lock
(
&
oc
->
boc
->
mtx
);
AZ
(
ObjGetU64
(
wrk
,
oc
,
OA_LEN
,
&
rv
));
while
(
1
)
{
rv
=
oc
->
boc
->
len_so_far
;
assert
(
l
<=
rv
||
oc
->
boc
->
state
==
BOS_FAILED
);
if
(
rv
>
l
||
oc
->
boc
->
state
>=
BOS_FINISHED
)
break
;
(
void
)
Lck_CondWait
(
&
oc
->
boc
->
cond
,
&
oc
->
boc
->
mtx
,
0
);
AZ
(
ObjGetU64
(
wrk
,
oc
,
OA_LEN
,
&
rv
));
}
rv
=
oc
->
boc
->
len_so_far
;
Lck_Unlock
(
&
oc
->
boc
->
mtx
);
return
(
rv
);
}
...
...
@@ -220,7 +216,8 @@ ObjWaitExtend(struct worker *wrk, struct objcore *oc, uint64_t l)
*/
void
ObjSetState
(
struct
worker
*
wrk
,
const
struct
objcore
*
oc
,
enum
boc_state_e
next
)
ObjSetState
(
struct
worker
*
wrk
,
const
struct
objcore
*
oc
,
enum
boc_state_e
next
)
{
const
struct
obj_methods
*
om
;
...
...
@@ -229,6 +226,8 @@ ObjSetState(struct worker *wrk, const struct objcore *oc, enum boc_state_e next)
assert
(
next
>
oc
->
boc
->
state
);
CHECK_OBJ_ORNULL
(
oc
->
stobj
->
stevedore
,
STEVEDORE_MAGIC
);
AN
(
next
!=
BOS_FINISHED
||
(
oc
->
oa_present
&
(
1
<<
OA_LEN
)));
if
(
oc
->
stobj
->
stevedore
!=
NULL
)
{
om
=
oc
->
stobj
->
stevedore
->
methods
;
if
(
om
->
objsetstate
!=
NULL
)
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
b1f0b29e
...
...
@@ -162,7 +162,6 @@ cnt_synth(struct worker *wrk, struct req *req)
if
(
req
->
err_code
<
100
||
req
->
err_code
>
999
)
req
->
err_code
=
501
;
HTTP_Setup
(
req
->
resp
,
req
->
ws
,
req
->
vsl
,
SLT_RespMethod
);
h
=
req
->
resp
;
http_TimeHeader
(
h
,
"Date: "
,
now
);
...
...
@@ -208,6 +207,8 @@ cnt_synth(struct worker *wrk, struct req *req)
}
}
if
(
szl
>=
0
)
AZ
(
ObjSetU64
(
wrk
,
req
->
objcore
,
OA_LEN
,
szl
));
HSH_DerefBoc
(
wrk
,
req
->
objcore
);
VSB_delete
(
synth_body
);
...
...
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