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
856edab5
Commit
856edab5
authored
Feb 07, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give the stevedore the chance to tell which LRU list a given object
should be on.
parent
e0d21c96
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
6 deletions
+40
-6
cache_expire.c
bin/varnishd/cache_expire.c
+2
-2
stevedore.c
bin/varnishd/stevedore.c
+21
-3
stevedore.h
bin/varnishd/stevedore.h
+3
-1
storage_persistent.c
bin/varnishd/storage_persistent.c
+14
-0
No files found.
bin/varnishd/cache_expire.c
View file @
856edab5
...
...
@@ -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
->
objstore
);
lru
=
STV_lru
(
o
);
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
->
objstore
);
lru
=
STV_lru
(
o
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
if
(
Lck_Trylock
(
&
exp_mtx
))
...
...
bin/varnishd/stevedore.c
View file @
856edab5
...
...
@@ -283,6 +283,19 @@ 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
)
{
...
...
@@ -386,11 +399,14 @@ STV_close(void)
}
struct
lru
*
STV_lru
(
const
struct
storage
*
st
)
STV_lru
(
const
struct
object
*
o
)
{
CHECK_OBJ_NOTNULL
(
st
,
STORAGE_MAGIC
);
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
(
st
->
stevedore
->
lru
);
return
(
o
->
objstore
->
stevedore
->
getlru
(
o
)
);
}
/*--------------------------------------------------------------------
...
...
@@ -455,6 +471,8 @@ 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 @
856edab5
...
...
@@ -43,6 +43,7 @@ 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 */
...
...
@@ -58,6 +59,7 @@ 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
;
/* --//-- */
...
...
@@ -86,7 +88,7 @@ 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
storage
*
st
);
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 @
856edab5
...
...
@@ -1427,6 +1427,19 @@ 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
...
...
@@ -1552,6 +1565,7 @@ const struct stevedore smp_stevedore = {
.
close
=
smp_close
,
.
alloc
=
smp_alloc
,
.
allocobj
=
smp_allocobj
,
.
getlru
=
smp_getlru
,
.
free
=
smp_free
,
.
trim
=
smp_trim
,
};
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