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
47f4078d
Commit
47f4078d
authored
May 18, 2012
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a EXP_NukeLRU() function to nuke an entire LRU structure at a time.
parent
7e5dce9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_expire.c
bin/varnishd/cache/cache_expire.c
+59
-0
No files found.
bin/varnishd/cache/cache.h
View file @
47f4078d
...
...
@@ -790,6 +790,7 @@ void EXP_Init(void);
void
EXP_Rearm
(
const
struct
object
*
o
);
int
EXP_Touch
(
struct
objcore
*
oc
);
int
EXP_NukeOne
(
struct
busyobj
*
,
struct
lru
*
lru
);
void
EXP_NukeLRU
(
struct
worker
*
wrk
,
struct
vsl_log
*
vsl
,
struct
lru
*
lru
);
/* cache_fetch.c */
struct
storage
*
FetchStorage
(
struct
busyobj
*
,
ssize_t
sz
);
...
...
bin/varnishd/cache/cache_expire.c
View file @
47f4078d
...
...
@@ -459,6 +459,65 @@ EXP_NukeOne(struct busyobj *bo, struct lru *lru)
return
(
1
);
}
/*--------------------------------------------------------------------
* Nukes an entire LRU
*/
#define NUKEBUF 10
/* XXX: Randomly chosen to be bigger than one */
void
EXP_NukeLRU
(
struct
worker
*
wrk
,
struct
vsl_log
*
vsl
,
struct
lru
*
lru
)
{
struct
objcore
*
oc
;
struct
objcore
*
oc_array
[
NUKEBUF
];
struct
object
*
o
;
int
i
,
n
;
double
t
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
t
=
VTIM_real
();
Lck_Lock
(
&
lru
->
mtx
);
while
(
!
VTAILQ_EMPTY
(
&
lru
->
lru_head
))
{
Lck_Lock
(
&
exp_mtx
);
n
=
0
;
while
(
n
<
NUKEBUF
)
{
oc
=
VTAILQ_FIRST
(
&
lru
->
lru_head
);
if
(
oc
==
NULL
)
break
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
assert
(
oc_getlru
(
oc
)
==
lru
);
/* Remove from the LRU and binheap */
VTAILQ_REMOVE
(
&
lru
->
lru_head
,
oc
,
lru_list
);
assert
(
oc
->
timer_idx
!=
BINHEAP_NOIDX
);
binheap_delete
(
exp_heap
,
oc
->
timer_idx
);
assert
(
oc
->
timer_idx
==
BINHEAP_NOIDX
);
oc_array
[
n
++
]
=
oc
;
VSC_C_main
->
n_lru_nuked
++
;
}
assert
(
n
>
0
);
Lck_Unlock
(
&
exp_mtx
);
Lck_Unlock
(
&
lru
->
mtx
);
for
(
i
=
0
;
i
<
n
;
i
++
)
{
oc
=
oc_array
[
i
];
o
=
oc_getobj
(
&
wrk
->
stats
,
oc
);
VSLb
(
vsl
,
SLT_ExpKill
,
"%u %.0f LRU"
,
oc_getxid
(
&
wrk
->
stats
,
oc
),
EXP_Ttl
(
NULL
,
o
)
-
t
);
EXP_Set_ttl
(
&
o
->
exp
,
0
.);
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
oc
,
NULL
);
}
Lck_Lock
(
&
lru
->
mtx
);
}
Lck_Unlock
(
&
lru
->
mtx
);
WRK_SumStat
(
wrk
);
}
/*--------------------------------------------------------------------
* BinHeap helper functions for objcore.
*/
...
...
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