[master] 2f940fb Move esi-policy from hash-lookup to req-fsm
Poul-Henning Kamp
phk at varnish-cache.org
Sat Apr 6 09:11:58 CEST 2013
commit 2f940fb94fa3258a6b79ec179c79c842bb4fd259
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sat Apr 6 07:11:27 2013 +0000
Move esi-policy from hash-lookup to req-fsm
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index b680605..7c51041 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -286,7 +286,7 @@ HSH_Insert(struct worker *wrk, const void *digest, struct objcore *oc)
*/
struct objcore *
-HSH_Lookup(struct req *req)
+HSH_Lookup(struct req *req, int wait_for_busy)
{
struct worker *wrk;
struct objhead *oh;
@@ -309,7 +309,7 @@ HSH_Lookup(struct req *req)
if (req->hash_objhead != NULL) {
/*
- * This sess came off the waiting list, and brings a
+ * This req came off the waiting list, and brings an
* oh refcnt with it.
*/
CHECK_OBJ_NOTNULL(req->hash_objhead, OBJHEAD_MAGIC);
@@ -409,7 +409,7 @@ HSH_Lookup(struct req *req)
if (busy_found) {
/* There are one or more busy objects, wait for them */
- if (req->esi_level == 0) {
+ if (wait_for_busy) {
CHECK_OBJ_NOTNULL(wrk->nwaitinglist,
WAITINGLIST_MAGIC);
if (oh->waitinglist == NULL) {
@@ -418,10 +418,14 @@ HSH_Lookup(struct req *req)
}
VTAILQ_INSERT_TAIL(&oh->waitinglist->list,
req, w_list);
+ if (DO_DEBUG(DBG_WAITINGLIST))
+ VSLb(req->vsl, SLT_Debug,
+ "on waiting list <%p>", oh);
+ } else {
+ if (DO_DEBUG(DBG_WAITINGLIST))
+ VSLb(req->vsl, SLT_Debug,
+ "hit busy obj <%p>", oh);
}
- if (DO_DEBUG(DBG_WAITINGLIST))
- VSLb(req->vsl, SLT_Debug,
- "on waiting list <%p>", oh);
wrk->stats.busy_sleep++;
SES_Charge(req->wrk, req);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 835ef42..7891a5c 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -751,7 +751,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
VRY_Prep(req);
AZ(req->objcore);
- oc = HSH_Lookup(req);
+ oc = HSH_Lookup(req, req->esi_level == 0 ? 1 : 0);
if (oc == NULL) {
/*
* We lost the session to a busy object, disembark the
diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h
index f90f592..f680881 100644
--- a/bin/varnishd/hash/hash_slinger.h
+++ b/bin/varnishd/hash/hash_slinger.h
@@ -53,7 +53,7 @@ struct hash_slinger {
/* cache_hash.c */
void HSH_Cleanup(struct worker *w);
-struct objcore *HSH_Lookup(struct req *);
+struct objcore *HSH_Lookup(struct req *, int wait_for_busy);
void HSH_Ref(struct objcore *o);
void HSH_Drop(struct worker *, struct object **);
void HSH_Init(const struct hash_slinger *slinger);
More information about the varnish-commit
mailing list