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
71891866
Commit
71891866
authored
Dec 04, 2018
by
Poul-Henning Kamp
Committed by
Dridi Boukelmoune
Feb 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify HSH_Lookup 3/N
Use req->hash_always_miss directly Inspired by: #2856
parent
5ee0e257
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
cache_hash.c
bin/varnishd/cache/cache_hash.c
+3
-4
cache_objhead.h
bin/varnishd/cache/cache_objhead.h
+1
-2
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+3
-2
No files found.
bin/varnishd/cache/cache_hash.c
View file @
71891866
...
@@ -338,8 +338,7 @@ hsh_insert_busyobj(struct worker *wrk, struct objhead *oh)
...
@@ -338,8 +338,7 @@ hsh_insert_busyobj(struct worker *wrk, struct objhead *oh)
*/
*/
enum
lookup_e
enum
lookup_e
HSH_Lookup
(
struct
req
*
req
,
struct
objcore
**
ocp
,
struct
objcore
**
bocp
,
HSH_Lookup
(
struct
req
*
req
,
struct
objcore
**
ocp
,
struct
objcore
**
bocp
)
int
always_insert
)
{
{
struct
worker
*
wrk
;
struct
worker
*
wrk
;
struct
objhead
*
oh
;
struct
objhead
*
oh
;
...
@@ -384,7 +383,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
...
@@ -384,7 +383,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
Lck_AssertHeld
(
&
oh
->
mtx
);
Lck_AssertHeld
(
&
oh
->
mtx
);
if
(
always_insert
)
{
if
(
req
->
hash_always_miss
)
{
/* XXX: should we do predictive Vary in this case ? */
/* XXX: should we do predictive Vary in this case ? */
/* Insert new objcore in objecthead and release mutex */
/* Insert new objcore in objecthead and release mutex */
*
bocp
=
hsh_insert_busyobj
(
wrk
,
oh
);
*
bocp
=
hsh_insert_busyobj
(
wrk
,
oh
);
...
@@ -472,7 +471,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
...
@@ -472,7 +471,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
wrk
->
stats
->
cache_hitmiss
++
;
wrk
->
stats
->
cache_hitmiss
++
;
VSLb
(
req
->
vsl
,
SLT_HitMiss
,
"%u %.6f"
,
xid
,
dttl
);
VSLb
(
req
->
vsl
,
SLT_HitMiss
,
"%u %.6f"
,
xid
,
dttl
);
return
(
HSH_HITMISS
);
return
(
HSH_HITMISS
);
}
}
if
(
oc
->
hits
<
LONG_MAX
)
if
(
oc
->
hits
<
LONG_MAX
)
oc
->
hits
++
;
oc
->
hits
++
;
AN
(
hsh_deref_objhead_unlock
(
wrk
,
&
oh
));
AN
(
hsh_deref_objhead_unlock
(
wrk
,
&
oh
));
...
...
bin/varnishd/cache/cache_objhead.h
View file @
71891866
...
@@ -68,8 +68,7 @@ int HSH_DerefObjCore(struct worker *, struct objcore **, int rushmax);
...
@@ -68,8 +68,7 @@ int HSH_DerefObjCore(struct worker *, struct objcore **, int rushmax);
#define HSH_RUSH_POLICY -1
#define HSH_RUSH_POLICY -1
#define HSH_RUSH_ALL INT_MAX
#define HSH_RUSH_ALL INT_MAX
enum
lookup_e
HSH_Lookup
(
struct
req
*
,
struct
objcore
**
,
struct
objcore
**
,
enum
lookup_e
HSH_Lookup
(
struct
req
*
,
struct
objcore
**
,
struct
objcore
**
);
int
always_insert
);
void
HSH_Ref
(
struct
objcore
*
o
);
void
HSH_Ref
(
struct
objcore
*
o
);
void
HSH_AddString
(
struct
req
*
,
void
*
ctx
,
const
char
*
str
);
void
HSH_AddString
(
struct
req
*
,
void
*
ctx
,
const
char
*
str
);
unsigned
HSH_Purge
(
struct
worker
*
,
struct
objhead
*
,
vtim_real
ttl_now
,
unsigned
HSH_Purge
(
struct
worker
*
,
struct
objhead
*
,
vtim_real
ttl_now
,
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
71891866
...
@@ -495,7 +495,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
...
@@ -495,7 +495,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
AZ
(
req
->
objcore
);
AZ
(
req
->
objcore
);
if
(
req
->
hash_objhead
)
if
(
req
->
hash_objhead
)
had_objhead
=
1
;
had_objhead
=
1
;
lr
=
HSH_Lookup
(
req
,
&
oc
,
&
busy
,
req
->
hash_always_miss
?
1
:
0
);
lr
=
HSH_Lookup
(
req
,
&
oc
,
&
busy
);
if
(
lr
==
HSH_BUSY
)
{
if
(
lr
==
HSH_BUSY
)
{
/*
/*
* We lost the session to a busy object, disembark the
* We lost the session to a busy object, disembark the
...
@@ -986,7 +986,8 @@ cnt_purge(struct worker *wrk, struct req *req)
...
@@ -986,7 +986,8 @@ cnt_purge(struct worker *wrk, struct req *req)
VRY_Prep
(
req
);
VRY_Prep
(
req
);
AZ
(
req
->
objcore
);
AZ
(
req
->
objcore
);
lr
=
HSH_Lookup
(
req
,
&
oc
,
&
boc
,
1
);
req
->
hash_always_miss
=
1
;
lr
=
HSH_Lookup
(
req
,
&
oc
,
&
boc
);
assert
(
lr
==
HSH_MISS
);
assert
(
lr
==
HSH_MISS
);
AZ
(
oc
);
AZ
(
oc
);
CHECK_OBJ_NOTNULL
(
boc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
boc
,
OBJCORE_MAGIC
);
...
...
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