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
149e6277
Commit
149e6277
authored
Aug 19, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put stats directly in vfp_ctx
parent
d1d73339
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
15 deletions
+18
-15
cache.h
bin/varnishd/cache/cache.h
+2
-1
cache_expire.c
bin/varnishd/cache/cache_expire.c
+9
-8
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+2
-0
cache_fetch_proc.c
bin/varnishd/cache/cache_fetch_proc.c
+1
-1
cache_obj.c
bin/varnishd/cache/cache_obj.c
+2
-2
stevedore.c
bin/varnishd/storage/stevedore.c
+2
-3
No files found.
bin/varnishd/cache/cache.h
View file @
149e6277
...
...
@@ -455,6 +455,7 @@ struct vfp_ctx {
unsigned
magic
;
#define VFP_CTX_MAGIC 0x61d9d3e5
struct
busyobj
*
bo
;
struct
dstat
*
stats
;
int
failed
;
...
...
@@ -894,7 +895,7 @@ void EXP_Init(void);
void
EXP_Rearm
(
struct
objcore
*
,
double
now
,
double
ttl
,
double
grace
,
double
keep
);
void
EXP_Touch
(
struct
objcore
*
oc
,
double
now
);
int
EXP_NukeOne
(
struct
busyobj
*
,
struct
lru
*
lru
);
int
EXP_NukeOne
(
struct
vsl_log
*
vsl
,
struct
dstat
*
ds
,
struct
lru
*
lru
);
/* cache_fetch.c */
enum
vbf_fetch_mode_e
{
...
...
bin/varnishd/cache/cache_expire.c
View file @
149e6277
...
...
@@ -286,17 +286,20 @@ EXP_Rearm(struct objcore *oc, double now, double ttl, double grace, double keep)
*/
int
EXP_NukeOne
(
struct
busyobj
*
bo
,
struct
lru
*
lru
)
EXP_NukeOne
(
struct
vsl_log
*
vsl
,
struct
dstat
*
ds
,
struct
lru
*
lru
)
{
struct
objcore
*
oc
,
*
oc2
;
struct
objhead
*
oh
;
AN
(
vsl
);
AN
(
ds
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
/* Find the first currently unused object on the LRU. */
Lck_Lock
(
&
lru
->
mtx
);
VTAILQ_FOREACH_SAFE
(
oc
,
&
lru
->
lru_head
,
lru_list
,
oc2
)
{
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
VSLb
(
bo
->
vsl
,
SLT_ExpKill
,
"LRU_Cand p=%p f=0x%x r=%d"
,
VSLb
(
vsl
,
SLT_ExpKill
,
"LRU_Cand p=%p f=0x%x r=%d"
,
oc
,
oc
->
flags
,
oc
->
refcnt
);
AZ
(
oc
->
exp_flags
&
OC_EF_OFFLRU
);
...
...
@@ -328,19 +331,17 @@ EXP_NukeOne(struct busyobj *bo, struct lru *lru)
Lck_Unlock
(
&
lru
->
mtx
);
if
(
oc
==
NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_ExpKill
,
"LRU_Fail"
);
VSLb
(
vsl
,
SLT_ExpKill
,
"LRU_Fail"
);
return
(
-
1
);
}
/* XXX: We could grab and return one storage segment to our caller */
ObjSlim
(
oc
,
bo
->
stat
s
);
ObjSlim
(
oc
,
d
s
);
exp_mail_it
(
oc
);
VSLb
(
bo
->
vsl
,
SLT_ExpKill
,
"LRU x=%u"
,
ObjGetXID
(
oc
,
bo
->
stats
));
AN
(
bo
->
stats
);
AN
(
oc
);
(
void
)
HSH_DerefObjCore
(
bo
->
stats
,
&
oc
);
VSLb
(
vsl
,
SLT_ExpKill
,
"LRU x=%u"
,
ObjGetXID
(
oc
,
ds
));
(
void
)
HSH_DerefObjCore
(
ds
,
&
oc
);
return
(
1
);
}
...
...
bin/varnishd/cache/cache_fetch.c
View file @
149e6277
...
...
@@ -364,6 +364,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
VFP_Setup
(
bo
->
vfc
);
bo
->
vfc
->
bo
=
bo
;
bo
->
vfc
->
stats
=
bo
->
stats
;
bo
->
vfc
->
http
=
bo
->
beresp
;
bo
->
vfc
->
vsl
=
bo
->
vsl
;
...
...
@@ -684,6 +685,7 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
VFP_Setup
(
bo
->
vfc
);
bo
->
vfc
->
bo
=
bo
;
bo
->
vfc
->
stats
=
bo
->
stats
;
bo
->
vfc
->
http
=
bo
->
beresp
;
bo
->
vfc
->
vsl
=
bo
->
vsl
;
...
...
bin/varnishd/cache/cache_fetch_proc.c
View file @
149e6277
...
...
@@ -86,7 +86,7 @@ VFP_GetStorage(struct vfp_ctx *vc, ssize_t sz)
if
(
st
!=
NULL
&&
st
->
len
<
st
->
space
)
return
(
st
);
AN
(
vc
->
bo
->
stats
);
AN
(
vc
->
stats
);
l
=
fetchfrag
;
if
(
l
==
0
)
l
=
sz
;
...
...
bin/varnishd/cache/cache_obj.c
View file @
149e6277
...
...
@@ -299,7 +299,7 @@ ObjSetattr(const struct vfp_ctx *vc, enum obj_attr attr, ssize_t len,
CHECK_OBJ_NOTNULL
(
vc
,
VFP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vc
->
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
vc
->
bo
->
fetch_objcore
,
OBJCORE_MAGIC
);
o
=
obj_getobj
(
vc
->
bo
->
fetch_objcore
,
vc
->
bo
->
stats
);
o
=
obj_getobj
(
vc
->
bo
->
fetch_objcore
,
vc
->
stats
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
switch
(
attr
)
{
case
OA_ESIDATA
:
...
...
@@ -347,7 +347,7 @@ ObjCopyAttr(const struct vfp_ctx *vc, struct objcore *ocs, enum obj_attr attr)
CHECK_OBJ_NOTNULL
(
vc
,
VFP_CTX_MAGIC
);
vps
=
ObjGetattr
(
ocs
,
vc
->
bo
->
stats
,
attr
,
&
l
);
vps
=
ObjGetattr
(
ocs
,
vc
->
stats
,
attr
,
&
l
);
// XXX: later we want to have zero-length OA's too
if
(
vps
==
NULL
||
l
<=
0
)
return
(
-
1
);
...
...
bin/varnishd/storage/stevedore.c
View file @
149e6277
...
...
@@ -195,7 +195,6 @@ stv_alloc_obj(const struct vfp_ctx *vc, size_t size)
*/
CHECK_OBJ_NOTNULL
(
vc
,
VFP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vc
->
bo
,
BUSYOBJ_MAGIC
);
AN
(
vc
->
bo
->
stats
);
stv
=
vc
->
body
->
stevedore
;
CHECK_OBJ_NOTNULL
(
stv
,
STEVEDORE_MAGIC
);
...
...
@@ -213,7 +212,7 @@ stv_alloc_obj(const struct vfp_ctx *vc, size_t size)
/* no luck; try to free some space and keep trying */
if
(
fail
<
cache_param
->
nuke_limit
&&
EXP_NukeOne
(
vc
->
bo
,
stv
->
lru
)
==
-
1
)
EXP_NukeOne
(
vc
->
vsl
,
vc
->
stats
,
stv
->
lru
)
==
-
1
)
break
;
}
CHECK_OBJ_ORNULL
(
st
,
STORAGE_MAGIC
);
...
...
@@ -349,7 +348,7 @@ STV_NewObject(struct busyobj *bo, const char *hint, unsigned wsl)
if
(
o
==
NULL
)
{
/* no luck; try to free some space and keep trying */
for
(
i
=
0
;
o
==
NULL
&&
i
<
cache_param
->
nuke_limit
;
i
++
)
{
if
(
EXP_NukeOne
(
bo
,
stv
->
lru
)
==
-
1
)
if
(
EXP_NukeOne
(
bo
->
vsl
,
bo
->
stats
,
stv
->
lru
)
==
-
1
)
break
;
o
=
stv
->
allocobj
(
stv
,
bo
,
ltot
,
&
soc
);
}
...
...
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