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
19ff7a59
Commit
19ff7a59
authored
Jan 10, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep track of and report how many return(vcl)'s hold a label
parent
6cd97d11
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
12 deletions
+37
-12
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+26
-6
mgt_vcl.c
bin/varnishd/mgt/mgt_vcl.c
+6
-4
vrt.h
include/vrt.h
+2
-1
vcc_action.c
lib/libvcc/vcc_action.c
+3
-1
No files found.
bin/varnishd/cache/cache_vcl.c
View file @
19ff7a59
...
...
@@ -72,6 +72,7 @@ struct vcl {
pthread_rwlock_t
temp_rwl
;
VTAILQ_HEAD
(,
backend
)
backend_list
;
VTAILQ_HEAD
(,
vclref
)
ref_list
;
int
nrefs
;
struct
vcl
*
label
;
int
nlabels
;
};
...
...
@@ -521,15 +522,29 @@ VRT_count(VRT_CTX, unsigned u)
}
VCL_VCL
VRT_vcl_
lookup
(
const
char
*
name
)
VRT_vcl_
get
(
VRT_CTX
,
const
char
*
name
)
{
VCL_VCL
vcl
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
vcl
=
vcl_find
(
name
);
AN
(
vcl
);
Lck_Lock
(
&
vcl_mtx
);
vcl
->
nrefs
++
;
Lck_Unlock
(
&
vcl_mtx
);
return
(
vcl
);
}
void
VRT_vcl_rel
(
VRT_CTX
,
VCL_VCL
vcl
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
vcl
);
Lck_Lock
(
&
vcl_mtx
);
vcl
->
nrefs
--
;
Lck_Unlock
(
&
vcl_mtx
);
}
void
VRT_vcl_select
(
VRT_CTX
,
VCL_VCL
vcl
)
{
...
...
@@ -564,6 +579,7 @@ VRT_ref_vcl(VRT_CTX, const char *desc)
Lck_Lock
(
&
vcl_mtx
);
VTAILQ_INSERT_TAIL
(
&
vcl
->
ref_list
,
ref
,
list
);
vcl
->
nrefs
++
;
Lck_Unlock
(
&
vcl_mtx
);
return
(
ref
);
...
...
@@ -595,6 +611,7 @@ VRT_rel_vcl(VRT_CTX, struct vclref **refp)
Lck_Lock
(
&
vcl_mtx
);
assert
(
!
VTAILQ_EMPTY
(
&
vcl
->
ref_list
));
VTAILQ_REMOVE
(
&
vcl
->
ref_list
,
ref
,
list
);
vcl
->
nrefs
--
;
/* No garbage collection here, for the same reasons as in VCL_Rel. */
Lck_Unlock
(
&
vcl_mtx
);
...
...
@@ -812,12 +829,15 @@ vcl_cli_list(struct cli *cli, const char * const *av, void *priv)
flg
=
"available"
;
VCLI_Out
(
cli
,
"%-10s %5s/%-8s %6u %s"
,
flg
,
vcl
->
state
,
vcl
->
temp
,
vcl
->
busy
,
vcl
->
loaded_name
);
if
(
vcl
->
label
!=
NULL
)
if
(
vcl
->
label
!=
NULL
)
{
VCLI_Out
(
cli
,
" -> %s"
,
vcl
->
label
->
loaded_name
);
else
if
(
vcl
->
nlabels
>
1
)
VCLI_Out
(
cli
,
" (%d labels)"
,
vcl
->
nlabels
);
else
if
(
vcl
->
nlabels
>
0
)
VCLI_Out
(
cli
,
" (%d label)"
,
vcl
->
nlabels
);
if
(
vcl
->
nrefs
)
VCLI_Out
(
cli
,
" (%d return(vcl)%s)"
,
vcl
->
nrefs
,
vcl
->
nrefs
>
1
?
"'s"
:
""
);
}
else
if
(
vcl
->
nlabels
>
0
)
{
VCLI_Out
(
cli
,
" (%d label%s)"
,
vcl
->
nlabels
,
vcl
->
nlabels
>
1
?
"s"
:
""
);
}
VCLI_Out
(
cli
,
"
\n
"
);
}
}
...
...
bin/varnishd/mgt/mgt_vcl.c
View file @
19ff7a59
...
...
@@ -643,15 +643,17 @@ mcf_vcl_list(struct cli *cli, const char * const *av, void *priv)
vp
->
state
);
VCLI_Out
(
cli
,
"/%-8s"
,
vp
->
warm
?
VCL_STATE_WARM
:
VCL_STATE_COLD
);
VCLI_Out
(
cli
,
" %6s %s"
,
""
,
vp
->
name
);
VCLI_Out
(
cli
,
" %6s %s"
,
"
-
"
,
vp
->
name
);
if
(
mcf_is_label
(
vp
))
{
vd
=
VTAILQ_FIRST
(
&
vp
->
dfrom
);
AN
(
vd
);
VCLI_Out
(
cli
,
" -> %s"
,
vd
->
to
->
name
);
}
else
if
(
vp
->
nto
>
1
)
{
VCLI_Out
(
cli
,
" (%d labels)"
,
vp
->
nto
);
if
(
vp
->
nto
>
0
)
VCLI_Out
(
cli
,
" (%d return(vcl)%s)"
,
vp
->
nto
,
vp
->
nto
>
1
?
"'s"
:
""
);
}
else
if
(
vp
->
nto
>
0
)
{
VCLI_Out
(
cli
,
" (%d label)"
,
vp
->
nto
);
VCLI_Out
(
cli
,
" (%d label%s)"
,
vp
->
nto
,
vp
->
nto
>
1
?
"s"
:
""
);
}
VCLI_Out
(
cli
,
"
\n
"
);
}
...
...
include/vrt.h
View file @
19ff7a59
...
...
@@ -319,7 +319,8 @@ int VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, void *ptr, int len,
void
VRT_Vmod_Fini
(
struct
vmod
**
hdl
);
/* VCL program related */
VCL_VCL
VRT_vcl_lookup
(
const
char
*
);
VCL_VCL
VRT_vcl_get
(
VRT_CTX
,
const
char
*
);
void
VRT_vcl_rel
(
VRT_CTX
,
VCL_VCL
);
void
VRT_vcl_select
(
VRT_CTX
,
VCL_VCL
);
struct
vmod_priv
;
...
...
lib/libvcc/vcc_action.c
View file @
19ff7a59
...
...
@@ -264,8 +264,10 @@ parse_return_vcl(struct vcc *tl)
p
=
New_IniFin
(
tl
);
AN
(
p
);
VSB_printf
(
p
->
ini
,
"
\t
%s = VRT_vcl_
lookup(
\"
%.*s
\"
);"
,
VSB_printf
(
p
->
ini
,
"
\t
%s = VRT_vcl_
get(ctx,
\"
%.*s
\"
);"
,
buf
,
PF
(
tl
->
t
));
VSB_printf
(
p
->
fin
,
"
\t
VRT_vcl_rel(ctx, %s);"
,
buf
);
}
Fb
(
tl
,
1
,
"VRT_vcl_select(ctx, %s);
\t
/* %.*s */
\n
"
,
(
const
char
*
)
sym
->
eval_priv
,
PF
(
tl
->
t
));
...
...
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