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
74889dda
Commit
74889dda
authored
Jun 26, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make persistent save the entire struct exp rather than only the deadline,
in preparation for moving exp from obj to objcore
parent
9f9c5127
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
17 deletions
+18
-17
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_expire.c
bin/varnishd/cache/cache_expire.c
+8
-8
storage_persistent.c
bin/varnishd/storage/storage_persistent.c
+2
-2
storage_persistent.h
bin/varnishd/storage/storage_persistent.h
+1
-1
storage_persistent_silo.c
bin/varnishd/storage/storage_persistent_silo.c
+6
-6
No files found.
bin/varnishd/cache/cache.h
View file @
74889dda
...
...
@@ -928,6 +928,7 @@ extern pthread_t cli_thread;
void
EXP_Clr
(
struct
exp
*
e
);
double
EXP_Ttl
(
const
struct
req
*
,
const
struct
object
*
);
double
EXP_When
(
const
struct
exp
*
exp
);
void
EXP_Insert
(
struct
objcore
*
oc
);
void
EXP_Inject
(
struct
objcore
*
oc
,
struct
lru
*
lru
,
double
when
);
void
EXP_Init
(
void
);
...
...
bin/varnishd/cache/cache_expire.c
View file @
74889dda
...
...
@@ -87,17 +87,17 @@ EXP_Ttl(const struct req *req, const struct object *o)
}
/*--------------------------------------------------------------------
* Calculate when
we should wake up for this object
* Calculate when
this object is no longer useful
*/
static
double
exp_when
(
const
struct
object
*
o
)
double
EXP_When
(
const
struct
exp
*
e
)
{
double
when
;
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
when
=
o
->
exp
.
t_origin
+
o
->
exp
.
ttl
+
o
->
exp
.
grace
+
o
->
exp
.
keep
;
if
(
e
->
t_origin
==
0
)
return
(
0
.);
when
=
e
->
t_origin
+
e
->
ttl
+
e
->
grace
+
e
->
keep
;
AZ
(
isnan
(
when
));
return
(
when
);
}
...
...
@@ -243,7 +243,7 @@ EXP_Rearm(struct object *o, double now, double ttl, double grace, double keep)
if
(
!
isnan
(
keep
))
o
->
exp
.
keep
=
keep
;
when
=
exp_when
(
o
);
when
=
EXP_When
(
&
o
->
exp
);
VSL
(
SLT_ExpKill
,
0
,
"EXP_Rearm p=%p E=%.9f e=%.9f f=0x%x"
,
oc
,
oc
->
timer_when
,
when
,
oc
->
flags
);
...
...
@@ -391,7 +391,7 @@ exp_inbox(struct exp_priv *ep, struct objcore *oc, double now)
if
(
flags
&
OC_EF_MOVE
)
{
o
=
oc_getobj
(
&
ep
->
wrk
->
stats
,
oc
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
oc
->
timer_when
=
exp_when
(
o
);
oc
->
timer_when
=
EXP_When
(
&
o
->
exp
);
oc_updatemeta
(
oc
);
}
...
...
bin/varnishd/storage/storage_persistent.c
View file @
74889dda
...
...
@@ -473,7 +473,7 @@ smp_allocx(struct stevedore *st, size_t min_size, size_t max_size,
sc
->
next_top
-=
sizeof
(
**
so
);
*
so
=
(
void
*
)(
sc
->
base
+
sc
->
next_top
);
/* Render this smp_object mostly harmless */
(
*
so
)
->
ttl
=
0
.
;
EXP_Clr
(
&
(
*
so
)
->
exp
)
;
(
*
so
)
->
ban
=
0
.;
(
*
so
)
->
ptr
=
0
;
sg
->
objs
=
*
so
;
...
...
@@ -545,7 +545,7 @@ smp_allocobj(struct stevedore *stv, struct busyobj *bo,
/* We have to do this somewhere, might as well be here... */
assert
(
sizeof
so
->
hash
==
DIGEST_LEN
);
memcpy
(
so
->
hash
,
oc
->
objhead
->
digest
,
DIGEST_LEN
);
so
->
ttl
=
oc
->
timer_when
;
so
->
exp
=
bo
->
exp
;
so
->
ptr
=
(
uint8_t
*
)
o
-
sc
->
base
;
so
->
ban
=
BAN_Time
(
oc
->
ban
);
...
...
bin/varnishd/storage/storage_persistent.h
View file @
74889dda
...
...
@@ -144,7 +144,7 @@ struct smp_segptr {
struct
smp_object
{
uint8_t
hash
[
32
];
/* really: DIGEST_LEN */
double
ttl
;
struct
exp
exp
;
double
ban
;
uint64_t
ptr
;
/* rel to silo */
};
...
...
bin/varnishd/storage/storage_persistent_silo.c
View file @
74889dda
...
...
@@ -148,7 +148,7 @@ smp_load_seg(struct worker *wrk, const struct smp_sc *sc,
/* Clear the bogus "hold" count */
sg
->
nobj
=
0
;
for
(;
no
>
0
;
so
++
,
no
--
)
{
if
(
so
->
ttl
==
0
||
so
->
ttl
<
t_now
)
if
(
EXP_When
(
&
so
->
exp
)
<
t_now
)
continue
;
ALLOC_OBJ
(
oc
,
OBJCORE_MAGIC
);
AN
(
oc
);
...
...
@@ -157,7 +157,7 @@ smp_load_seg(struct worker *wrk, const struct smp_sc *sc,
smp_init_oc
(
oc
,
sg
,
no
);
oc
->
ban
=
BAN_RefBan
(
oc
,
so
->
ban
,
sc
->
tailban
);
HSH_Insert
(
wrk
,
so
->
hash
,
oc
);
EXP_Inject
(
oc
,
sg
->
lru
,
so
->
ttl
);
EXP_Inject
(
oc
,
sg
->
lru
,
EXP_When
(
&
so
->
exp
)
);
sg
->
nobj
++
;
}
Pool_Sumstat
(
wrk
);
...
...
@@ -463,7 +463,7 @@ smp_oc_getobj(struct dstat *ds, struct objcore *oc)
if
(
bad
)
{
o
->
exp
.
ttl
=
-
1
;
so
->
ttl
=
0
;
EXP_Clr
(
&
so
->
exp
)
;
}
sg
->
nfixed
++
;
...
...
@@ -495,11 +495,11 @@ smp_oc_updatemeta(struct objcore *oc)
/* Lock necessary, we might race close_seg */
Lck_Lock
(
&
sg
->
sc
->
mtx
);
so
->
ban
=
BAN_Time
(
oc
->
ban
);
so
->
ttl
=
oc
->
timer_when
;
so
->
exp
=
o
->
exp
;
;
Lck_Unlock
(
&
sg
->
sc
->
mtx
);
}
else
{
so
->
ban
=
BAN_Time
(
oc
->
ban
);
so
->
ttl
=
oc
->
timer_when
;
so
->
exp
=
o
->
exp
;
;
}
}
...
...
@@ -515,7 +515,7 @@ smp_oc_freeobj(struct objcore *oc)
so
=
smp_find_so
(
sg
,
oc
->
priv2
);
Lck_Lock
(
&
sg
->
sc
->
mtx
);
so
->
ttl
=
0
;
EXP_Clr
(
&
so
->
exp
)
;
so
->
ptr
=
0
;
assert
(
sg
->
nobj
>
0
);
...
...
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