Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
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
unique-xids
Commits
ef2face7
Commit
ef2face7
authored
Feb 09, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The LRU is a property of the objcore which is on it, not of
whatever storage we have put the object into.
parent
9b8035d6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
67 deletions
+59
-67
cache.h
bin/varnishd/cache.h
+9
-0
cache_expire.c
bin/varnishd/cache_expire.c
+2
-2
stevedore.c
bin/varnishd/stevedore.c
+10
-26
stevedore.h
bin/varnishd/stevedore.h
+0
-3
storage_persistent.c
bin/varnishd/storage_persistent.c
+24
-36
storage_persistent_silo.c
bin/varnishd/storage_persistent_silo.c
+14
-0
No files found.
bin/varnishd/cache.h
View file @
ef2face7
...
...
@@ -354,11 +354,13 @@ struct storage {
typedef
struct
object
*
getobj_f
(
struct
worker
*
wrk
,
struct
objcore
*
oc
);
typedef
void
updatemeta_f
(
struct
objcore
*
oc
);
typedef
void
freeobj_f
(
struct
objcore
*
oc
);
typedef
struct
lru
*
getlru_f
(
const
struct
objcore
*
oc
);
struct
objcore_methods
{
getobj_f
*
getobj
;
updatemeta_f
*
updatemeta
;
freeobj_f
*
freeobj
;
getlru_f
*
getlru
;
};
extern
struct
objcore_methods
default_oc_methods
;
...
...
@@ -407,6 +409,13 @@ oc_freeobj(struct objcore *oc)
oc
->
methods
->
freeobj
(
oc
);
}
static
inline
struct
lru
*
oc_getlru
(
const
struct
objcore
*
oc
)
{
return
(
oc
->
methods
->
getlru
(
oc
));
}
/*--------------------------------------------------------------------*/
struct
lru
{
...
...
bin/varnishd/cache_expire.c
View file @
ef2face7
...
...
@@ -143,7 +143,7 @@ EXP_Insert(struct object *o)
assert
(
o
->
entered
!=
0
&&
!
isnan
(
o
->
entered
));
o
->
last_lru
=
o
->
entered
;
lru
=
STV_lru
(
o
);
lru
=
oc_getlru
(
oc
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
Lck_Lock
(
&
exp_mtx
);
(
void
)
update_object_when
(
o
);
...
...
@@ -180,7 +180,7 @@ EXP_Touch(struct object *o, double tnow)
if
(
oc
->
flags
&
OC_F_LRUDONTMOVE
)
return
;
lru
=
STV_lru
(
o
);
lru
=
oc_getlru
(
oc
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
if
(
Lck_Trylock
(
&
exp_mtx
))
...
...
bin/varnishd/stevedore.c
View file @
ef2face7
...
...
@@ -283,19 +283,6 @@ STV_NewObject(struct sess *sp, const char *hint, unsigned wsl, double ttl,
/*-------------------------------------------------------------------*/
static
struct
lru
*
stv_default_getlru
(
const
struct
object
*
o
)
{
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
->
objstore
,
STORAGE_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
->
objstore
->
stevedore
,
STEVEDORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
->
objstore
->
stevedore
->
lru
,
LRU_MAGIC
);
return
(
o
->
objstore
->
stevedore
->
lru
);
}
/*-------------------------------------------------------------------*/
void
STV_Freestore
(
struct
object
*
o
)
{
...
...
@@ -341,9 +328,19 @@ default_oc_freeobj(struct objcore *oc)
STV_free
(
o
->
objstore
);
}
static
struct
lru
*
default_oc_getlru
(
const
struct
objcore
*
oc
)
{
struct
object
*
o
;
CAST_OBJ_NOTNULL
(
o
,
oc
->
priv
,
OBJECT_MAGIC
);
return
(
o
->
objstore
->
stevedore
->
lru
);
}
struct
objcore_methods
default_oc_methods
=
{
.
getobj
=
default_oc_getobj
,
.
freeobj
=
default_oc_freeobj
,
.
getlru
=
default_oc_getlru
,
};
/*-------------------------------------------------------------------*/
...
...
@@ -402,17 +399,6 @@ STV_close(void)
stv
->
close
(
stv
);
}
struct
lru
*
STV_lru
(
const
struct
object
*
o
)
{
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
->
objstore
,
STORAGE_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
->
objstore
->
stevedore
,
STEVEDORE_MAGIC
);
AN
(
o
->
objstore
->
stevedore
->
getlru
);
return
(
o
->
objstore
->
stevedore
->
getlru
(
o
));
}
/*--------------------------------------------------------------------
* Parse a stevedore argument on the form:
* [ name '=' ] strategy [ ',' arg ] *
...
...
@@ -475,8 +461,6 @@ STV_Config(const char *spec)
AN
(
stv
->
alloc
);
if
(
stv
->
allocobj
==
NULL
)
stv
->
allocobj
=
stv_default_allocobj
;
if
(
stv
->
getlru
==
NULL
)
stv
->
getlru
=
stv_default_getlru
;
if
(
p
==
NULL
)
bprintf
(
stv
->
ident
,
"s%u"
,
seq
++
);
...
...
bin/varnishd/stevedore.h
View file @
ef2face7
...
...
@@ -43,7 +43,6 @@ typedef void storage_trim_f(struct storage *, size_t size);
typedef
void
storage_free_f
(
struct
storage
*
);
typedef
struct
object
*
storage_allocobj_f
(
struct
stevedore
*
,
struct
sess
*
sp
,
unsigned
ltot
,
const
struct
stv_objsecrets
*
);
typedef
struct
lru
*
storage_getlru_f
(
const
struct
object
*
);
typedef
void
storage_close_f
(
const
struct
stevedore
*
);
/* Prototypes for VCL variable responders */
...
...
@@ -59,7 +58,6 @@ struct stevedore {
storage_init_f
*
init
;
/* called by mgt process */
storage_open_f
*
open
;
/* called by cache process */
storage_alloc_f
*
alloc
;
/* --//-- */
storage_getlru_f
*
getlru
;
/* --//-- */
storage_trim_f
*
trim
;
/* --//-- */
storage_free_f
*
free
;
/* --//-- */
storage_close_f
*
close
;
/* --//-- */
...
...
@@ -88,7 +86,6 @@ void STV_trim(struct storage *st, size_t size);
void
STV_free
(
struct
storage
*
st
);
void
STV_open
(
void
);
void
STV_close
(
void
);
struct
lru
*
STV_lru
(
const
struct
object
*
o
);
void
STV_Config
(
const
char
*
spec
);
void
STV_Config_Transient
(
void
);
void
STV_Freestore
(
struct
object
*
o
);
...
...
bin/varnishd/storage_persistent.c
View file @
ef2face7
...
...
@@ -66,7 +66,7 @@ SVNID("$Id$")
static
VTAILQ_HEAD
(,
smp_sc
)
silos
=
VTAILQ_HEAD_INITIALIZER
(
silos
);
/*--------------------------------------------------------------------
* Add
a new ban to all
silos
* Add
bans to
silos
*/
static
void
...
...
@@ -96,6 +96,8 @@ smp_appendban(struct smp_sc *sc, struct smp_signctx *ctx, double t0,
smp_append_sign
(
ctx
,
ptr2
,
ptr
-
ptr2
);
}
/* Trust that cache_ban.c takes care of locking */
void
SMP_NewBan
(
double
t0
,
const
char
*
ban
)
{
...
...
@@ -165,8 +167,6 @@ smp_open_bans(struct smp_sc *sc, struct smp_signctx *ctx)
return
(
retval
);
}
/*--------------------------------------------------------------------
* Attempt to open and read in a segment list
*/
...
...
@@ -467,20 +467,6 @@ smp_allocx(struct stevedore *st, size_t min_size, size_t max_size,
return
(
ss
);
}
/*--------------------------------------------------------------------
* Find the per-segment lru list for this object
*/
static
struct
lru
*
smp_getlru
(
const
struct
object
*
o
)
{
struct
smp_seg
*
sg
;
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CAST_OBJ_NOTNULL
(
sg
,
o
->
objcore
->
priv
,
SMP_SEG_MAGIC
);
return
(
sg
->
lru
);
}
/*--------------------------------------------------------------------
* Allocate an object
*/
...
...
@@ -575,24 +561,6 @@ smp_free(struct storage *st)
(
void
)
st
;
}
/*--------------------------------------------------------------------
* Pause until all silos have loaded.
*/
void
SMP_Ready
(
void
)
{
struct
smp_sc
*
sc
;
ASSERT_CLI
();
do
{
VTAILQ_FOREACH
(
sc
,
&
silos
,
list
)
if
(
!
(
sc
->
flags
&
SMP_SC_LOADED
))
break
;
if
(
sc
!=
NULL
)
(
void
)
sleep
(
1
);
}
while
(
sc
!=
NULL
);
}
/*--------------------------------------------------------------------*/
...
...
@@ -604,7 +572,6 @@ const struct stevedore smp_stevedore = {
.
close
=
smp_close
,
.
alloc
=
smp_alloc
,
.
allocobj
=
smp_allocobj
,
.
getlru
=
smp_getlru
,
.
free
=
smp_free
,
.
trim
=
smp_trim
,
};
...
...
@@ -692,8 +659,29 @@ static struct cli_proto debug_cmds[] = {
{
NULL
}
};
/*--------------------------------------------------------------------*/
void
SMP_Init
(
void
)
{
CLI_AddFuncs
(
debug_cmds
);
}
/*--------------------------------------------------------------------
* Pause until all silos have loaded.
*/
void
SMP_Ready
(
void
)
{
struct
smp_sc
*
sc
;
ASSERT_CLI
();
do
{
VTAILQ_FOREACH
(
sc
,
&
silos
,
list
)
if
(
!
(
sc
->
flags
&
SMP_SC_LOADED
))
break
;
if
(
sc
!=
NULL
)
(
void
)
sleep
(
1
);
}
while
(
sc
!=
NULL
);
}
bin/varnishd/storage_persistent_silo.c
View file @
ef2face7
...
...
@@ -503,10 +503,24 @@ smp_oc_freeobj(struct objcore *oc)
Lck_Unlock
(
&
sg
->
sc
->
mtx
);
}
/*--------------------------------------------------------------------
* Find the per-segment lru list for this object
*/
static
struct
lru
*
smp_oc_getlru
(
const
struct
objcore
*
oc
)
{
struct
smp_seg
*
sg
;
CAST_OBJ_NOTNULL
(
sg
,
oc
->
priv
,
SMP_SEG_MAGIC
);
return
(
sg
->
lru
);
}
static
struct
objcore_methods
smp_oc_methods
=
{
.
getobj
=
smp_oc_getobj
,
.
updatemeta
=
smp_oc_updatemeta
,
.
freeobj
=
smp_oc_freeobj
,
.
getlru
=
smp_oc_getlru
,
};
/*--------------------------------------------------------------------*/
...
...
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