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
bba23ef1
Commit
bba23ef1
authored
Mar 19, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move obj.hits to objhead, make it read-only
parent
2001b7ef
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
28 deletions
+17
-28
cache.h
bin/varnishd/cache/cache.h
+0
-2
cache_hash.c
bin/varnishd/cache/cache_hash.c
+4
-3
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+10
-21
hash_slinger.h
bin/varnishd/hash/hash_slinger.h
+2
-0
v00013.vtc
bin/varnishtest/tests/v00013.vtc
+0
-1
generate.py
lib/libvcc/generate.py
+1
-1
No files found.
bin/varnishd/cache/cache.h
View file @
bba23ef1
...
...
@@ -609,8 +609,6 @@ struct object {
struct
exp
exp
;
/* VCL only variables */
long
hits
;
double
last_modified
;
struct
http
*
http
;
...
...
bin/varnishd/cache/cache_hash.c
View file @
bba23ef1
...
...
@@ -433,6 +433,8 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
assert
(
oh
->
refcnt
>
1
);
assert
(
oc
->
objhead
==
oh
);
oc
->
refcnt
++
;
if
(
oh
->
hits
<
LONG_MAX
)
oh
->
hits
++
;
Lck_Unlock
(
&
oh
->
mtx
);
assert
(
HSH_DerefObjHead
(
&
wrk
->
stats
,
&
oh
));
*
ocp
=
oc
;
...
...
@@ -460,12 +462,11 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
}
else
{
retval
=
HSH_EXP
;
}
if
(
oh
->
hits
<
LONG_MAX
)
oh
->
hits
++
;
Lck_Unlock
(
&
oh
->
mtx
);
if
(
retval
==
HSH_EXP
)
assert
(
HSH_DerefObjHead
(
&
wrk
->
stats
,
&
oh
));
if
(
!
cache_param
->
obj_readonly
&&
exp_o
->
hits
<
INT_MAX
)
exp_o
->
hits
++
;
*
ocp
=
exp_oc
;
return
(
retval
);
}
...
...
bin/varnishd/cache/cache_vrt_var.c
View file @
bba23ef1
...
...
@@ -36,6 +36,7 @@
#include "cache.h"
#include "common/heritage.h"
#include "hash/hash_slinger.h"
#include "cache_backend.h"
#include "vrt.h"
...
...
@@ -570,29 +571,17 @@ VRT_r_server_hostname(const struct vrt_ctx *ctx)
/*--------------------------------------------------------------------*/
#define VOBJ_L(type, field) \
void \
VRT_l_obj_##field(const struct vrt_ctx *ctx, type a) \
{ \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->req->obj, OBJECT_MAGIC); \
ctx->req->obj->field = a; \
}
#define VOBJ_R(type, field) \
type \
VRT_r_obj_##field(const struct vrt_ctx *ctx) \
{ \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->req->obj, OBJECT_MAGIC); \
return (ctx->req->obj->field); \
long
VRT_r_obj_hits
(
const
struct
vrt_ctx
*
ctx
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
->
obj
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
->
obj
->
objcore
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
->
obj
->
objcore
->
objhead
,
OBJHEAD_MAGIC
);
return
(
ctx
->
req
->
obj
->
objcore
->
objhead
->
hits
);
}
VOBJ_L
(
long
,
hits
)
VOBJ_R
(
long
,
hits
)
unsigned
VRT_r_obj_uncacheable
(
const
struct
vrt_ctx
*
ctx
)
{
...
...
bin/varnishd/hash/hash_slinger.h
View file @
bba23ef1
...
...
@@ -94,6 +94,8 @@ struct objhead {
uint8_t
digest
[
DIGEST_LEN
];
struct
waitinglist
*
waitinglist
;
long
hits
;
/*----------------------------------------------------
* The fields below are for the sole private use of
* the hash implementation(s).
...
...
bin/varnishtest/tests/v00013.vtc
View file @
bba23ef1
...
...
@@ -13,7 +13,6 @@ varnish v1 -vcl+backend {
sub vcl_deliver {
set resp.http.foo = obj.hits;
set obj.hits = obj.hits + 1;
}
} -start
...
...
lib/libvcc/generate.py
View file @
bba23ef1
...
...
@@ -512,7 +512,7 @@ sp_variables = [
(
'obj.hits'
,
'INT'
,
(
'hit'
,
'deliver'
,),
(
'hit'
,
'deliver'
,
),
"""
(
),
"""
The approximate number of times the object has been
delivered. A value of 0 indicates a cache miss.
This variable is also available in vcl_deliver.
...
...
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