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
219aa029
Commit
219aa029
authored
Feb 19, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate struct sess from HSH_Insert()
parent
1bda6584
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
36 additions
and
42 deletions
+36
-42
cache_ban.c
bin/varnishd/cache/cache_ban.c
+1
-1
cache_expire.c
bin/varnishd/cache/cache_expire.c
+1
-1
cache_hash.c
bin/varnishd/cache/cache_hash.c
+4
-9
hash_classic.c
bin/varnishd/hash/hash_classic.c
+6
-6
hash_critbit.c
bin/varnishd/hash/hash_critbit.c
+9
-9
hash_simple_list.c
bin/varnishd/hash/hash_simple_list.c
+5
-5
hash_slinger.h
bin/varnishd/hash/hash_slinger.h
+2
-2
storage_persistent.c
bin/varnishd/storage/storage_persistent.c
+3
-3
storage_persistent.h
bin/varnishd/storage/storage_persistent.h
+1
-2
storage_persistent_silo.c
bin/varnishd/storage/storage_persistent_silo.c
+4
-4
No files found.
bin/varnishd/cache/cache_ban.c
View file @
219aa029
...
...
@@ -800,7 +800,7 @@ ban_CheckLast(void)
* Ban lurker thread
*/
static
int
static
int
__match_proto__
(
bgthread_t
)
ban_lurker_work
(
const
struct
sess
*
sp
,
unsigned
pass
)
{
struct
ban
*
b
,
*
b0
,
*
b2
;
...
...
bin/varnishd/cache/cache_expire.c
View file @
219aa029
...
...
@@ -329,7 +329,7 @@ EXP_Rearm(const struct object *o)
* object expires, accounting also for graceability, it is killed.
*/
static
void
*
__match_proto__
(
void
*
start_routine
(
void
*
)
)
static
void
*
__match_proto__
(
bgthread_t
)
exp_timer
(
struct
sess
*
sp
,
void
*
priv
)
{
struct
objcore
*
oc
;
...
...
bin/varnishd/cache/cache_hash.c
View file @
219aa029
...
...
@@ -245,26 +245,21 @@ hsh_testmagic(void *result)
*/
void
HSH_Insert
(
const
struct
sess
*
sp
,
const
void
*
digest
,
struct
objcore
*
oc
)
HSH_Insert
(
struct
worker
*
wrk
,
const
void
*
digest
,
struct
objcore
*
oc
)
{
struct
worker
*
wrk
;
struct
objhead
*
oh
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER
_MAGIC
);
AN
(
digest
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
wrk
=
sp
->
wrk
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
hsh_prealloc
(
wrk
);
if
(
cache_param
->
diag_bitmap
&
0x80000000
)
hsh_testmagic
(
wrk
->
nobjhead
->
digest
);
AZ
(
sp
->
req
);
AN
(
wrk
->
nobjhead
);
memcpy
(
wrk
->
nobjhead
->
digest
,
digest
,
SHA256_LEN
);
oh
=
hash
->
lookup
(
sp
,
wrk
->
nobjhead
);
oh
=
hash
->
lookup
(
wrk
,
wrk
->
nobjhead
);
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
if
(
oh
==
wrk
->
nobjhead
)
wrk
->
nobjhead
=
NULL
;
...
...
@@ -320,7 +315,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
sp
->
req
->
hash_objhead
=
NULL
;
}
else
{
AN
(
wrk
->
nobjhead
);
oh
=
hash
->
lookup
(
sp
,
wrk
->
nobjhead
);
oh
=
hash
->
lookup
(
wrk
,
wrk
->
nobjhead
);
if
(
oh
==
wrk
->
nobjhead
)
wrk
->
nobjhead
=
NULL
;
}
...
...
bin/varnishd/hash/hash_classic.c
View file @
219aa029
...
...
@@ -54,7 +54,7 @@ static struct hcl_hd *hcl_head;
* The ->init method allows the management process to pass arguments
*/
static
void
static
void
__match_proto__
(
hash_init_f
)
hcl_init
(
int
ac
,
char
*
const
*
av
)
{
int
i
;
...
...
@@ -86,7 +86,7 @@ hcl_init(int ac, char * const *av)
* initialization to happen before the first lookup.
*/
static
void
static
void
__match_proto__
(
hash_start_f
)
hcl_start
(
void
)
{
unsigned
u
;
...
...
@@ -110,15 +110,15 @@ hcl_start(void)
* rare and collisions even rarer.
*/
static
struct
objhead
*
hcl_lookup
(
const
struct
sess
*
sp
,
struct
objhead
*
noh
)
static
struct
objhead
*
__match_proto__
(
hash_lookup_f
)
hcl_lookup
(
struct
worker
*
wrk
,
struct
objhead
*
noh
)
{
struct
objhead
*
oh
;
struct
hcl_hd
*
hp
;
unsigned
u1
,
digest
;
int
i
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER
_MAGIC
);
CHECK_OBJ_NOTNULL
(
noh
,
OBJHEAD_MAGIC
);
assert
(
sizeof
noh
->
digest
>
sizeof
digest
);
...
...
@@ -153,7 +153,7 @@ hcl_lookup(const struct sess *sp, struct objhead *noh)
* Dereference and if no references are left, free.
*/
static
int
static
int
__match_proto__
(
hash_deref_f
)
hcl_deref
(
struct
objhead
*
oh
)
{
struct
hcl_hd
*
hp
;
...
...
bin/varnishd/hash/hash_critbit.c
View file @
219aa029
...
...
@@ -373,7 +373,7 @@ hcb_cleaner(struct sess *sp, void *priv)
/*--------------------------------------------------------------------*/
static
void
static
void
__match_proto__
(
hash_start_f
)
hcb_start
(
void
)
{
struct
objhead
*
oh
=
NULL
;
...
...
@@ -387,7 +387,7 @@ hcb_start(void)
hcb_build_bittbl
();
}
static
int
static
int
__match_proto__
(
hash_deref_f
)
hcb_deref
(
struct
objhead
*
oh
)
{
int
r
;
...
...
@@ -412,28 +412,28 @@ hcb_deref(struct objhead *oh)
return
(
r
);
}
static
struct
objhead
*
hcb_lookup
(
const
struct
sess
*
sp
,
struct
objhead
*
noh
)
static
struct
objhead
*
__match_proto__
(
hash_lookup_f
)
hcb_lookup
(
struct
worker
*
wrk
,
struct
objhead
*
noh
)
{
struct
objhead
*
oh
;
struct
hcb_y
*
y
;
unsigned
u
;
unsigned
with_lock
;
(
void
)
sp
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
)
;
with_lock
=
0
;
while
(
1
)
{
if
(
with_lock
)
{
CAST_OBJ_NOTNULL
(
y
,
sp
->
wrk
->
nhashpriv
,
HCB_Y_MAGIC
);
CAST_OBJ_NOTNULL
(
y
,
wrk
->
nhashpriv
,
HCB_Y_MAGIC
);
Lck_Lock
(
&
hcb_mtx
);
VSC_C_main
->
hcb_lock
++
;
assert
(
noh
->
refcnt
==
1
);
oh
=
hcb_insert
(
sp
->
wrk
,
&
hcb_root
,
noh
,
1
);
oh
=
hcb_insert
(
wrk
,
&
hcb_root
,
noh
,
1
);
Lck_Unlock
(
&
hcb_mtx
);
}
else
{
VSC_C_main
->
hcb_nolock
++
;
oh
=
hcb_insert
(
sp
->
wrk
,
&
hcb_root
,
noh
,
0
);
oh
=
hcb_insert
(
wrk
,
&
hcb_root
,
noh
,
0
);
}
if
(
oh
!=
NULL
&&
oh
==
noh
)
{
...
...
@@ -468,7 +468,7 @@ hcb_lookup(const struct sess *sp, struct objhead *noh)
}
}
static
void
static
void
__match_proto__
(
hash_prep_f
)
hcb_prep
(
struct
worker
*
wrk
)
{
struct
hcb_y
*
y
;
...
...
bin/varnishd/hash/hash_simple_list.c
View file @
219aa029
...
...
@@ -45,7 +45,7 @@ static struct lock hsl_mtx;
* initialization to happen before the first lookup.
*/
static
void
static
void
__match_proto__
(
hash_start_f
)
hsl_start
(
void
)
{
...
...
@@ -59,13 +59,13 @@ hsl_start(void)
* A reference to the returned object is held.
*/
static
struct
objhead
*
hsl_lookup
(
const
struct
sess
*
sp
,
struct
objhead
*
noh
)
static
struct
objhead
*
__match_proto__
(
hash_lookup_f
)
hsl_lookup
(
struct
worker
*
wrk
,
struct
objhead
*
noh
)
{
struct
objhead
*
oh
;
int
i
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER
_MAGIC
);
CHECK_OBJ_NOTNULL
(
noh
,
OBJHEAD_MAGIC
);
Lck_Lock
(
&
hsl_mtx
);
VTAILQ_FOREACH
(
oh
,
&
hsl_head
,
hoh_list
)
{
...
...
@@ -92,7 +92,7 @@ hsl_lookup(const struct sess *sp, struct objhead *noh)
* Dereference and if no references are left, free.
*/
static
int
static
int
__match_proto__
(
hash_deref_f
)
hsl_deref
(
struct
objhead
*
oh
)
{
int
ret
;
...
...
bin/varnishd/hash/hash_slinger.h
View file @
219aa029
...
...
@@ -36,7 +36,7 @@ typedef void hash_init_f(int ac, char * const *av);
typedef
void
hash_start_f
(
void
);
typedef
void
hash_prep_f
(
struct
worker
*
);
typedef
struct
objhead
*
hash_lookup_f
(
const
struct
sess
*
sp
,
struct
objhead
*
nobj
);
hash_lookup_f
(
struct
worker
*
wrk
,
struct
objhead
*
nobj
);
typedef
int
hash_deref_f
(
struct
objhead
*
obj
);
struct
hash_slinger
{
...
...
@@ -58,7 +58,7 @@ void HSH_Ref(struct objcore *o);
void
HSH_Drop
(
struct
worker
*
,
struct
object
**
);
void
HSH_Init
(
const
struct
hash_slinger
*
slinger
);
void
HSH_AddString
(
const
struct
sess
*
sp
,
const
char
*
str
);
void
HSH_Insert
(
const
struct
sess
*
sp
,
const
void
*
hash
,
struct
objcore
*
);
void
HSH_Insert
(
struct
worker
*
,
const
void
*
hash
,
struct
objcore
*
);
void
HSH_Purge
(
const
struct
sess
*
,
struct
objhead
*
,
double
ttl
,
double
grace
);
void
HSH_config
(
const
char
*
h_arg
);
...
...
bin/varnishd/storage/storage_persistent.c
View file @
219aa029
...
...
@@ -267,19 +267,19 @@ smp_open_segs(struct smp_sc *sc, struct smp_signctx *ctx)
* Silo worker thread
*/
static
void
*
static
void
*
__match_proto__
(
bgthread_t
)
smp_thread
(
struct
sess
*
sp
,
void
*
priv
)
{
struct
smp_sc
*
sc
;
struct
smp_seg
*
sg
;
(
void
)
sp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
)
;
CAST_OBJ_NOTNULL
(
sc
,
priv
,
SMP_SC_MAGIC
);
/* First, load all the objects from all segments */
VTAILQ_FOREACH
(
sg
,
&
sc
->
segments
,
list
)
if
(
sg
->
flags
&
SMP_SEG_MUSTLOAD
)
smp_load_seg
(
sp
,
sc
,
sg
);
smp_load_seg
(
sp
->
wrk
,
sc
,
sg
);
sc
->
flags
|=
SMP_SC_LOADED
;
BAN_TailDeref
(
&
sc
->
tailban
);
...
...
bin/varnishd/storage/storage_persistent.h
View file @
219aa029
...
...
@@ -167,8 +167,7 @@ void smp_mgt_init(struct stevedore *parent, int ac, char * const *av);
/* storage_persistent_silo.c */
void
smp_load_seg
(
const
struct
sess
*
sp
,
const
struct
smp_sc
*
sc
,
struct
smp_seg
*
sg
);
void
smp_load_seg
(
struct
worker
*
,
const
struct
smp_sc
*
sc
,
struct
smp_seg
*
sg
);
void
smp_new_seg
(
struct
smp_sc
*
sc
);
void
smp_close_seg
(
struct
smp_sc
*
sc
,
struct
smp_seg
*
sg
);
void
smp_init_oc
(
struct
objcore
*
oc
,
struct
smp_seg
*
sg
,
unsigned
objidx
);
...
...
bin/varnishd/storage/storage_persistent_silo.c
View file @
219aa029
...
...
@@ -118,7 +118,7 @@ smp_save_segs(struct smp_sc *sc)
*/
void
smp_load_seg
(
const
struct
sess
*
sp
,
const
struct
smp_sc
*
sc
,
smp_load_seg
(
struct
worker
*
wrk
,
const
struct
smp_sc
*
sc
,
struct
smp_seg
*
sg
)
{
struct
smp_object
*
so
;
...
...
@@ -128,7 +128,7 @@ smp_load_seg(const struct sess *sp, const struct smp_sc *sc,
struct
smp_signctx
ctx
[
1
];
ASSERT_SILO_THREAD
(
sc
);
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER
_MAGIC
);
CHECK_OBJ_NOTNULL
(
sg
,
SMP_SEG_MAGIC
);
CHECK_OBJ_NOTNULL
(
sg
->
lru
,
LRU_MAGIC
);
assert
(
sg
->
flags
&
SMP_SEG_MUSTLOAD
);
...
...
@@ -156,11 +156,11 @@ smp_load_seg(const struct sess *sp, const struct smp_sc *sc,
oc
->
flags
&=
~
OC_F_BUSY
;
smp_init_oc
(
oc
,
sg
,
no
);
oc
->
ban
=
BAN_RefBan
(
oc
,
so
->
ban
,
sc
->
tailban
);
HSH_Insert
(
sp
,
so
->
hash
,
oc
);
HSH_Insert
(
wrk
,
so
->
hash
,
oc
);
EXP_Inject
(
oc
,
sg
->
lru
,
so
->
ttl
);
sg
->
nobj
++
;
}
WRK_SumStat
(
sp
->
wrk
);
WRK_SumStat
(
wrk
);
sg
->
flags
|=
SMP_SEG_LOADED
;
}
...
...
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