Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent3
Commits
7264c919
Commit
7264c919
authored
Mar 02, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move grace and ttl variables into a common structure and rename
HSH_Grace() to EXP_Grace()
parent
72d94d7c
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
57 deletions
+62
-57
cache.h
bin/varnishd/cache.h
+11
-5
cache_ban.c
bin/varnishd/cache_ban.c
+3
-3
cache_center.c
bin/varnishd/cache_center.c
+8
-8
cache_expire.c
bin/varnishd/cache_expire.c
+9
-1
cache_hash.c
bin/varnishd/cache_hash.c
+9
-17
cache_session.c
bin/varnishd/cache_session.c
+1
-1
cache_vrt_var.c
bin/varnishd/cache_vrt_var.c
+12
-12
hash_slinger.h
bin/varnishd/hash_slinger.h
+0
-1
stevedore.c
bin/varnishd/stevedore.c
+2
-2
storage_persistent.c
bin/varnishd/storage_persistent.c
+2
-2
storage_persistent_silo.c
bin/varnishd/storage_persistent_silo.c
+5
-5
No files found.
bin/varnishd/cache.h
View file @
7264c919
...
@@ -232,6 +232,13 @@ extern struct vfp vfp_esi;
...
@@ -232,6 +232,13 @@ extern struct vfp vfp_esi;
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
struct
exp
{
double
ttl
;
double
grace
;
};
/*--------------------------------------------------------------------*/
struct
worker
{
struct
worker
{
unsigned
magic
;
unsigned
magic
;
#define WORKER_MAGIC 0x6391adcf
#define WORKER_MAGIC 0x6391adcf
...
@@ -272,8 +279,7 @@ struct worker {
...
@@ -272,8 +279,7 @@ struct worker {
double
age
;
double
age
;
double
entered
;
double
entered
;
double
ttl
;
struct
exp
exp
;
double
grace
;
/* This is only here so VRT can find it */
/* This is only here so VRT can find it */
const
char
*
storage_hint
;
const
char
*
storage_hint
;
...
@@ -449,10 +455,9 @@ struct object {
...
@@ -449,10 +455,9 @@ struct object {
ssize_t
len
;
ssize_t
len
;
double
ttl
;
double
age
;
double
age
;
double
entered
;
double
entered
;
double
grace
;
struct
exp
exp
;
double
last_modified
;
double
last_modified
;
double
last_lru
;
double
last_lru
;
...
@@ -517,7 +522,7 @@ struct sess {
...
@@ -517,7 +522,7 @@ struct sess {
double
t_end
;
double
t_end
;
/* Acceptable grace period */
/* Acceptable grace period */
double
grace
;
struct
exp
exp
;
enum
step
step
;
enum
step
step
;
unsigned
cur_method
;
unsigned
cur_method
;
...
@@ -628,6 +633,7 @@ extern pthread_t cli_thread;
...
@@ -628,6 +633,7 @@ extern pthread_t cli_thread;
#define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0)
#define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0)
/* cache_expiry.c */
/* cache_expiry.c */
double
EXP_Grace
(
double
g
);
void
EXP_Insert
(
struct
object
*
o
);
void
EXP_Insert
(
struct
object
*
o
);
void
EXP_Inject
(
struct
objcore
*
oc
,
struct
lru
*
lru
,
double
when
);
void
EXP_Inject
(
struct
objcore
*
oc
,
struct
lru
*
lru
,
double
when
);
void
EXP_Init
(
void
);
void
EXP_Init
(
void
);
...
...
bin/varnishd/cache_ban.c
View file @
7264c919
...
@@ -475,8 +475,8 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
...
@@ -475,8 +475,8 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
oc_updatemeta
(
oc
);
oc_updatemeta
(
oc
);
return
(
0
);
return
(
0
);
}
else
{
}
else
{
o
->
ttl
=
0
;
o
->
exp
.
ttl
=
0
;
o
->
grace
=
0
;
o
->
exp
.
grace
=
0
;
oc
->
ban
=
NULL
;
oc
->
ban
=
NULL
;
oc_updatemeta
(
oc
);
oc_updatemeta
(
oc
);
/* BAN also changed, but that is not important any more */
/* BAN also changed, but that is not important any more */
...
@@ -543,7 +543,7 @@ ban_lurker(struct sess *sp, void *priv)
...
@@ -543,7 +543,7 @@ ban_lurker(struct sess *sp, void *priv)
// AZ(oc->flags & OC_F_PERSISTENT);
// AZ(oc->flags & OC_F_PERSISTENT);
o
=
oc_getobj
(
sp
->
wrk
,
oc
);
o
=
oc_getobj
(
sp
->
wrk
,
oc
);
i
=
ban_check_object
(
o
,
sp
,
0
);
i
=
ban_check_object
(
o
,
sp
,
0
);
WSP
(
sp
,
SLT_Debug
,
"lurker: %p %g %d"
,
oc
,
o
->
ttl
,
i
);
WSP
(
sp
,
SLT_Debug
,
"lurker: %p %g %d"
,
oc
,
o
->
exp
.
ttl
,
i
);
(
void
)
HSH_Deref
(
sp
->
wrk
,
NULL
,
&
o
);
(
void
)
HSH_Deref
(
sp
->
wrk
,
NULL
,
&
o
);
TIM_sleep
(
params
->
ban_lurker_sleep
);
TIM_sleep
(
params
->
ban_lurker_sleep
);
}
}
...
...
bin/varnishd/cache_center.c
View file @
7264c919
...
@@ -527,7 +527,7 @@ cnt_fetch(struct sess *sp)
...
@@ -527,7 +527,7 @@ cnt_fetch(struct sess *sp)
*/
*/
sp
->
wrk
->
entered
=
TIM_real
();
sp
->
wrk
->
entered
=
TIM_real
();
sp
->
wrk
->
age
=
0
;
sp
->
wrk
->
age
=
0
;
sp
->
wrk
->
ttl
=
RFC2616_Ttl
(
sp
);
sp
->
wrk
->
exp
.
ttl
=
RFC2616_Ttl
(
sp
);
/*
/*
* Initial cacheability determination per [RFC2616, 13.4]
* Initial cacheability determination per [RFC2616, 13.4]
...
@@ -543,16 +543,16 @@ cnt_fetch(struct sess *sp)
...
@@ -543,16 +543,16 @@ cnt_fetch(struct sess *sp)
case
404
:
/* Not Found */
case
404
:
/* Not Found */
break
;
break
;
default:
default:
sp
->
wrk
->
ttl
=
sp
->
t_req
-
1
.;
sp
->
wrk
->
exp
.
ttl
=
sp
->
t_req
-
1
.;
break
;
break
;
}
}
/* pass from vclrecv{} has negative TTL */
/* pass from vclrecv{} has negative TTL */
if
(
sp
->
objcore
==
NULL
)
if
(
sp
->
objcore
==
NULL
)
sp
->
wrk
->
ttl
=
sp
->
t_req
-
1
.;
sp
->
wrk
->
exp
.
ttl
=
sp
->
t_req
-
1
.;
sp
->
wrk
->
do_esi
=
0
;
sp
->
wrk
->
do_esi
=
0
;
sp
->
wrk
->
grace
=
NAN
;
sp
->
wrk
->
exp
.
grace
=
NAN
;
sp
->
wrk
->
body_status
=
RFC2616_Body
(
sp
);
sp
->
wrk
->
body_status
=
RFC2616_Body
(
sp
);
...
@@ -564,7 +564,7 @@ cnt_fetch(struct sess *sp)
...
@@ -564,7 +564,7 @@ cnt_fetch(struct sess *sp)
/* This is a pass from vcl_recv */
/* This is a pass from vcl_recv */
pass
=
1
;
pass
=
1
;
/* VCL may have fiddled this, but that doesn't help */
/* VCL may have fiddled this, but that doesn't help */
sp
->
wrk
->
ttl
=
sp
->
t_req
-
1
.;
sp
->
wrk
->
exp
.
ttl
=
sp
->
t_req
-
1
.;
}
else
if
(
sp
->
handling
==
VCL_RET_HIT_FOR_PASS
)
{
}
else
if
(
sp
->
handling
==
VCL_RET_HIT_FOR_PASS
)
{
/* pass from vcl_fetch{} -> hit-for-pass */
/* pass from vcl_fetch{} -> hit-for-pass */
/* XXX: the bereq was not filtered pass... */
/* XXX: the bereq was not filtered pass... */
...
@@ -653,12 +653,12 @@ cnt_fetch(struct sess *sp)
...
@@ -653,12 +653,12 @@ cnt_fetch(struct sess *sp)
*/
*/
l
+=
strlen
(
"Content-Length: XxxXxxXxxXxxXxxXxx"
)
+
sizeof
(
void
*
);
l
+=
strlen
(
"Content-Length: XxxXxxXxxXxxXxxXxx"
)
+
sizeof
(
void
*
);
if
(
sp
->
wrk
->
ttl
<
sp
->
t_req
+
params
->
shortlived
||
if
(
sp
->
wrk
->
exp
.
ttl
<
sp
->
t_req
+
params
->
shortlived
||
sp
->
objcore
==
NULL
)
sp
->
objcore
==
NULL
)
sp
->
wrk
->
storage_hint
=
TRANSIENT_STORAGE
;
sp
->
wrk
->
storage_hint
=
TRANSIENT_STORAGE
;
sp
->
obj
=
STV_NewObject
(
sp
,
sp
->
wrk
->
storage_hint
,
l
,
sp
->
obj
=
STV_NewObject
(
sp
,
sp
->
wrk
->
storage_hint
,
l
,
sp
->
wrk
->
ttl
,
nhttp
);
sp
->
wrk
->
exp
.
ttl
,
nhttp
);
/* XXX: -> 513 */
/* XXX: -> 513 */
CHECK_OBJ_NOTNULL
(
sp
->
obj
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
->
obj
,
OBJECT_MAGIC
);
...
@@ -678,7 +678,7 @@ cnt_fetch(struct sess *sp)
...
@@ -678,7 +678,7 @@ cnt_fetch(struct sess *sp)
sp
->
obj
->
xid
=
sp
->
xid
;
sp
->
obj
->
xid
=
sp
->
xid
;
sp
->
obj
->
response
=
sp
->
err_code
;
sp
->
obj
->
response
=
sp
->
err_code
;
sp
->
obj
->
grace
=
sp
->
wrk
->
grace
;
sp
->
obj
->
exp
.
grace
=
sp
->
wrk
->
exp
.
grace
;
sp
->
obj
->
age
=
sp
->
wrk
->
age
;
sp
->
obj
->
age
=
sp
->
wrk
->
age
;
sp
->
obj
->
entered
=
sp
->
wrk
->
entered
;
sp
->
obj
->
entered
=
sp
->
wrk
->
entered
;
WS_Assert
(
sp
->
obj
->
ws_o
);
WS_Assert
(
sp
->
obj
->
ws_o
);
...
...
bin/varnishd/cache_expire.c
View file @
7264c919
...
@@ -57,6 +57,14 @@ static pthread_t exp_thread;
...
@@ -57,6 +57,14 @@ static pthread_t exp_thread;
static
struct
binheap
*
exp_heap
;
static
struct
binheap
*
exp_heap
;
static
struct
lock
exp_mtx
;
static
struct
lock
exp_mtx
;
double
EXP_Grace
(
double
g
)
{
if
(
isnan
(
g
))
return
(
double
)(
params
->
default_grace
);
return
(
g
);
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* When & why does the timer fire for this object ?
* When & why does the timer fire for this object ?
*/
*/
...
@@ -72,7 +80,7 @@ update_object_when(const struct object *o)
...
@@ -72,7 +80,7 @@ update_object_when(const struct object *o)
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
Lck_AssertHeld
(
&
exp_mtx
);
Lck_AssertHeld
(
&
exp_mtx
);
when
=
o
->
ttl
+
HSH_Grace
(
o
->
grace
);
when
=
o
->
exp
.
ttl
+
EXP_Grace
(
o
->
exp
.
grace
);
assert
(
!
isnan
(
when
));
assert
(
!
isnan
(
when
));
if
(
when
==
oc
->
timer_when
)
if
(
when
==
oc
->
timer_when
)
return
(
0
);
return
(
0
);
...
...
bin/varnishd/cache_hash.c
View file @
7264c919
...
@@ -72,14 +72,6 @@ SVNID("$Id$")
...
@@ -72,14 +72,6 @@ SVNID("$Id$")
static
const
struct
hash_slinger
*
hash
;
static
const
struct
hash_slinger
*
hash
;
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
double
HSH_Grace
(
double
g
)
{
if
(
isnan
(
g
))
return
(
double
)(
params
->
default_grace
);
return
(
g
);
}
/* Precreate an objhead and object for later use */
/* Precreate an objhead and object for later use */
void
void
HSH_Prealloc
(
const
struct
sess
*
sp
)
HSH_Prealloc
(
const
struct
sess
*
sp
)
...
@@ -362,7 +354,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
...
@@ -362,7 +354,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
o
=
oc_getobj
(
sp
->
wrk
,
oc
);
o
=
oc_getobj
(
sp
->
wrk
,
oc
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
if
(
o
->
ttl
==
0
)
if
(
o
->
exp
.
ttl
==
0
)
continue
;
continue
;
if
(
BAN_CheckObject
(
o
,
sp
))
if
(
BAN_CheckObject
(
o
,
sp
))
continue
;
continue
;
...
@@ -370,17 +362,17 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
...
@@ -370,17 +362,17 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
continue
;
continue
;
/* If still valid, use it */
/* If still valid, use it */
if
(
o
->
ttl
>=
sp
->
t_req
)
if
(
o
->
exp
.
ttl
>=
sp
->
t_req
)
break
;
break
;
/*
/*
* Remember any matching objects inside their grace period
* Remember any matching objects inside their grace period
* and if there are several, use the least expired one.
* and if there are several, use the least expired one.
*/
*/
if
(
o
->
ttl
+
HSH_Grace
(
o
->
grace
)
>=
sp
->
t_req
)
{
if
(
o
->
exp
.
ttl
+
EXP_Grace
(
o
->
exp
.
grace
)
>=
sp
->
t_req
)
{
if
(
grace_oc
==
NULL
||
grace_ttl
<
o
->
ttl
)
{
if
(
grace_oc
==
NULL
||
grace_ttl
<
o
->
exp
.
ttl
)
{
grace_oc
=
oc
;
grace_oc
=
oc
;
grace_ttl
=
o
->
ttl
;
grace_ttl
=
o
->
exp
.
ttl
;
}
}
}
}
}
}
...
@@ -404,7 +396,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
...
@@ -404,7 +396,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
/* Or it is impossible to fetch */
/* Or it is impossible to fetch */
o
=
oc_getobj
(
sp
->
wrk
,
grace_oc
);
o
=
oc_getobj
(
sp
->
wrk
,
grace_oc
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
if
(
o
->
ttl
+
HSH_Grace
(
sp
->
grace
)
>=
sp
->
t_req
)
if
(
o
->
exp
.
ttl
+
EXP_Grace
(
sp
->
exp
.
grace
)
>=
sp
->
t_req
)
oc
=
grace_oc
;
oc
=
grace_oc
;
}
}
sp
->
objcore
=
NULL
;
sp
->
objcore
=
NULL
;
...
@@ -552,9 +544,9 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace)
...
@@ -552,9 +544,9 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace)
if
(
o
==
NULL
)
if
(
o
==
NULL
)
continue
;
continue
;
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
o
->
ttl
=
sp
->
t_req
+
ttl
;
o
->
exp
.
ttl
=
sp
->
t_req
+
ttl
;
if
(
!
isnan
(
grace
))
if
(
!
isnan
(
grace
))
o
->
grace
=
grace
;
o
->
exp
.
grace
=
grace
;
EXP_Rearm
(
o
);
EXP_Rearm
(
o
);
(
void
)
HSH_Deref
(
sp
->
wrk
,
NULL
,
&
o
);
(
void
)
HSH_Deref
(
sp
->
wrk
,
NULL
,
&
o
);
}
}
...
@@ -577,7 +569,7 @@ HSH_Drop(struct sess *sp)
...
@@ -577,7 +569,7 @@ HSH_Drop(struct sess *sp)
o
=
sp
->
obj
;
o
=
sp
->
obj
;
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
AssertObjPassOrBusy
(
o
);
AssertObjPassOrBusy
(
o
);
o
->
ttl
=
0
;
o
->
exp
.
ttl
=
0
;
if
(
o
->
objcore
!=
NULL
)
/* Pass has no objcore */
if
(
o
->
objcore
!=
NULL
)
/* Pass has no objcore */
HSH_Unbusy
(
sp
);
HSH_Unbusy
(
sp
);
(
void
)
HSH_Deref
(
sp
->
wrk
,
NULL
,
&
sp
->
obj
);
(
void
)
HSH_Deref
(
sp
->
wrk
,
NULL
,
&
sp
->
obj
);
...
...
bin/varnishd/cache_session.c
View file @
7264c919
...
@@ -174,7 +174,7 @@ ses_setup(struct sessmem *sm)
...
@@ -174,7 +174,7 @@ ses_setup(struct sessmem *sm)
sp
->
t_req
=
NAN
;
sp
->
t_req
=
NAN
;
sp
->
t_resp
=
NAN
;
sp
->
t_resp
=
NAN
;
sp
->
t_end
=
NAN
;
sp
->
t_end
=
NAN
;
sp
->
grace
=
NAN
;
sp
->
exp
.
grace
=
NAN
;
WS_Init
(
sp
->
ws
,
"sess"
,
sm
->
wsp
,
sm
->
workspace
);
WS_Init
(
sp
->
ws
,
"sess"
,
sm
->
wsp
,
sm
->
workspace
);
sp
->
http
=
sm
->
http
[
0
];
sp
->
http
=
sm
->
http
[
0
];
...
...
bin/varnishd/cache_vrt_var.c
View file @
7264c919
...
@@ -247,17 +247,17 @@ VRT_l_beresp_ttl(const struct sess *sp, double a)
...
@@ -247,17 +247,17 @@ VRT_l_beresp_ttl(const struct sess *sp, double a)
* We special case and make sure that rounding does not surprise.
* We special case and make sure that rounding does not surprise.
*/
*/
if
(
a
<=
0
)
{
if
(
a
<=
0
)
{
sp
->
wrk
->
ttl
=
sp
->
t_req
-
1
;
sp
->
wrk
->
exp
.
ttl
=
sp
->
t_req
-
1
;
sp
->
wrk
->
grace
=
0
.;
sp
->
wrk
->
exp
.
grace
=
0
.;
}
else
}
else
sp
->
wrk
->
ttl
=
sp
->
t_req
+
a
;
sp
->
wrk
->
exp
.
ttl
=
sp
->
t_req
+
a
;
}
}
double
double
VRT_r_beresp_ttl
(
const
struct
sess
*
sp
)
VRT_r_beresp_ttl
(
const
struct
sess
*
sp
)
{
{
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
return
(
sp
->
wrk
->
ttl
-
sp
->
t_req
);
return
(
sp
->
wrk
->
exp
.
ttl
-
sp
->
t_req
);
}
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
...
@@ -351,10 +351,10 @@ VRT_l_obj_ttl(const struct sess *sp, double a)
...
@@ -351,10 +351,10 @@ VRT_l_obj_ttl(const struct sess *sp, double a)
* We special case and make sure that rounding does not surprise.
* We special case and make sure that rounding does not surprise.
*/
*/
if
(
a
<=
0
)
{
if
(
a
<=
0
)
{
sp
->
obj
->
ttl
=
sp
->
t_req
-
1
;
sp
->
obj
->
exp
.
ttl
=
sp
->
t_req
-
1
;
sp
->
obj
->
grace
=
0
;
sp
->
obj
->
exp
.
grace
=
0
;
}
else
}
else
sp
->
obj
->
ttl
=
sp
->
t_req
+
a
;
sp
->
obj
->
exp
.
ttl
=
sp
->
t_req
+
a
;
EXP_Rearm
(
sp
->
obj
);
EXP_Rearm
(
sp
->
obj
);
}
}
...
@@ -365,7 +365,7 @@ VRT_r_obj_ttl(const struct sess *sp)
...
@@ -365,7 +365,7 @@ VRT_r_obj_ttl(const struct sess *sp)
CHECK_OBJ_NOTNULL
(
sp
->
obj
,
OBJECT_MAGIC
);
/* XXX */
CHECK_OBJ_NOTNULL
(
sp
->
obj
,
OBJECT_MAGIC
);
/* XXX */
if
(
sp
->
obj
->
objcore
==
NULL
)
if
(
sp
->
obj
->
objcore
==
NULL
)
return
(
0
.
0
);
return
(
0
.
0
);
return
(
sp
->
obj
->
ttl
-
sp
->
t_req
);
return
(
sp
->
obj
->
exp
.
ttl
-
sp
->
t_req
);
}
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
...
@@ -451,12 +451,12 @@ VRT_r_##which##_grace(struct sess *sp) \
...
@@ -451,12 +451,12 @@ VRT_r_##which##_grace(struct sess *sp) \
{ \
{ \
\
\
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \
return(
HSH
_Grace(fld)); \
return(
EXP
_Grace(fld)); \
}
}
VRT_DO_GRACE
(
req
,
sp
->
grace
,
)
VRT_DO_GRACE
(
req
,
sp
->
exp
.
grace
,
)
VRT_DO_GRACE
(
obj
,
sp
->
obj
->
grace
,
EXP_Rearm
(
sp
->
obj
))
VRT_DO_GRACE
(
obj
,
sp
->
obj
->
exp
.
grace
,
EXP_Rearm
(
sp
->
obj
))
VRT_DO_GRACE
(
beresp
,
sp
->
wrk
->
grace
,
)
VRT_DO_GRACE
(
beresp
,
sp
->
wrk
->
exp
.
grace
,
)
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* req.xid
* req.xid
...
...
bin/varnishd/hash_slinger.h
View file @
7264c919
...
@@ -58,7 +58,6 @@ struct objcore *HSH_Lookup(struct sess *sp, struct objhead **poh);
...
@@ -58,7 +58,6 @@ struct objcore *HSH_Lookup(struct sess *sp, struct objhead **poh);
void
HSH_Unbusy
(
const
struct
sess
*
sp
);
void
HSH_Unbusy
(
const
struct
sess
*
sp
);
void
HSH_Ref
(
struct
objcore
*
o
);
void
HSH_Ref
(
struct
objcore
*
o
);
void
HSH_Drop
(
struct
sess
*
sp
);
void
HSH_Drop
(
struct
sess
*
sp
);
double
HSH_Grace
(
double
g
);
void
HSH_Init
(
void
);
void
HSH_Init
(
void
);
void
HSH_AddString
(
const
struct
sess
*
sp
,
const
char
*
str
);
void
HSH_AddString
(
const
struct
sess
*
sp
,
const
char
*
str
);
void
HSH_FindBan
(
const
struct
sess
*
sp
,
struct
objcore
**
oc
);
void
HSH_FindBan
(
const
struct
sess
*
sp
,
struct
objcore
**
oc
);
...
...
bin/varnishd/stevedore.c
View file @
7264c919
...
@@ -198,9 +198,9 @@ STV_MkObject(struct sess *sp, void *ptr, unsigned ltot,
...
@@ -198,9 +198,9 @@ STV_MkObject(struct sess *sp, void *ptr, unsigned ltot,
http_Setup
(
o
->
http
,
o
->
ws_o
);
http_Setup
(
o
->
http
,
o
->
ws_o
);
o
->
http
->
magic
=
HTTP_MAGIC
;
o
->
http
->
magic
=
HTTP_MAGIC
;
o
->
grace
=
NAN
;
o
->
exp
.
grace
=
NAN
;
o
->
entered
=
NAN
;
o
->
entered
=
NAN
;
o
->
ttl
=
soc
->
ttl
;
o
->
exp
.
ttl
=
soc
->
ttl
;
VTAILQ_INIT
(
&
o
->
store
);
VTAILQ_INIT
(
&
o
->
store
);
sp
->
wrk
->
stats
.
n_object
++
;
sp
->
wrk
->
stats
.
n_object
++
;
...
...
bin/varnishd/storage_persistent.c
View file @
7264c919
...
@@ -493,7 +493,7 @@ smp_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot,
...
@@ -493,7 +493,7 @@ smp_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot,
CAST_OBJ_NOTNULL
(
sc
,
stv
->
priv
,
SMP_SC_MAGIC
);
CAST_OBJ_NOTNULL
(
sc
,
stv
->
priv
,
SMP_SC_MAGIC
);
AN
(
sp
->
objcore
);
AN
(
sp
->
objcore
);
AN
(
sp
->
wrk
->
ttl
>=
0
);
AN
(
sp
->
wrk
->
exp
.
ttl
>=
0
);
ltot
=
IRNUP
(
sc
,
ltot
);
ltot
=
IRNUP
(
sc
,
ltot
);
...
@@ -519,7 +519,7 @@ smp_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot,
...
@@ -519,7 +519,7 @@ smp_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot,
/* We have to do this somewhere, might as well be here... */
/* We have to do this somewhere, might as well be here... */
assert
(
sizeof
so
->
hash
==
DIGEST_LEN
);
assert
(
sizeof
so
->
hash
==
DIGEST_LEN
);
memcpy
(
so
->
hash
,
oc
->
objhead
->
digest
,
DIGEST_LEN
);
memcpy
(
so
->
hash
,
oc
->
objhead
->
digest
,
DIGEST_LEN
);
so
->
ttl
=
o
->
ttl
;
/* XXX: grace? */
so
->
ttl
=
o
->
exp
.
ttl
;
/* XXX: grace? */
so
->
ptr
=
(
uint8_t
*
)
o
-
sc
->
base
;
so
->
ptr
=
(
uint8_t
*
)
o
-
sc
->
base
;
so
->
ban
=
o
->
ban_t
;
so
->
ban
=
o
->
ban_t
;
...
...
bin/varnishd/storage_persistent_silo.c
View file @
7264c919
...
@@ -433,8 +433,8 @@ smp_oc_getobj(struct worker *wrk, struct objcore *oc)
...
@@ -433,8 +433,8 @@ smp_oc_getobj(struct worker *wrk, struct objcore *oc)
bad
|=
0x100
;
bad
|=
0x100
;
if
(
bad
)
{
if
(
bad
)
{
o
->
ttl
=
0
;
o
->
exp
.
ttl
=
0
;
o
->
grace
=
0
;
o
->
exp
.
grace
=
0
;
so
->
ttl
=
0
;
so
->
ttl
=
0
;
}
}
...
@@ -463,10 +463,10 @@ smp_oc_updatemeta(struct objcore *oc)
...
@@ -463,10 +463,10 @@ smp_oc_updatemeta(struct objcore *oc)
CHECK_OBJ_NOTNULL
(
sg
->
sc
,
SMP_SC_MAGIC
);
CHECK_OBJ_NOTNULL
(
sg
->
sc
,
SMP_SC_MAGIC
);
so
=
smp_find_so
(
sg
,
oc
);
so
=
smp_find_so
(
sg
,
oc
);
if
(
isnan
(
o
->
grace
))
if
(
isnan
(
o
->
exp
.
grace
))
mttl
=
o
->
ttl
;
mttl
=
o
->
exp
.
ttl
;
else
else
mttl
=
-
(
o
->
ttl
+
o
->
grace
);
mttl
=
-
(
o
->
exp
.
ttl
+
o
->
exp
.
grace
);
if
(
sg
==
sg
->
sc
->
cur_seg
)
{
if
(
sg
==
sg
->
sc
->
cur_seg
)
{
/* Lock necessary, we might race close_seg */
/* Lock necessary, we might race close_seg */
...
...
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