[master] 1c14a9d Make the waitinglist hold req instead of sp

Poul-Henning Kamp phk at varnish-cache.org
Tue Jun 19 12:53:47 CEST 2012


commit 1c14a9d49f30093fe58c6986b68456d9e300cd16
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jun 19 10:53:32 2012 +0000

    Make the waitinglist hold req instead of sp

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 6ee34ec..f013084 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -562,6 +562,7 @@ struct req {
 	uint8_t			hash_always_miss;
 
 	struct sess		*sp;
+	VTAILQ_ENTRY(req)	w_list;
 
 	/* The busy objhead we sleep on */
 	struct objhead		*hash_objhead;
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 68e4cda..e7c2a49 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -419,7 +419,7 @@ HSH_Lookup(struct req *req)
 				wrk->nwaitinglist = NULL;
 			}
 			VTAILQ_INSERT_TAIL(&oh->waitinglist->list,
-			    req->sp, list);
+			    req, w_list);
 		}
 		if (cache_param->diag_bitmap & 0x20)
 			VSLb(req->vsl, SLT_Debug,
@@ -469,6 +469,7 @@ static void
 hsh_rush(struct dstat *ds, struct objhead *oh)
 {
 	unsigned u;
+	struct req *req;
 	struct sess *sp;
 	struct waitinglist *wl;
 
@@ -477,12 +478,14 @@ hsh_rush(struct dstat *ds, struct objhead *oh)
 	wl = oh->waitinglist;
 	CHECK_OBJ_NOTNULL(wl, WAITINGLIST_MAGIC);
 	for (u = 0; u < cache_param->rush_exponent; u++) {
-		sp = VTAILQ_FIRST(&wl->list);
-		if (sp == NULL)
+		req = VTAILQ_FIRST(&wl->list);
+		if (req == NULL)
 			break;
+		CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+		sp = req->sp;
 		CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 		AZ(sp->wrk);
-		VTAILQ_REMOVE(&wl->list, sp, list);
+		VTAILQ_REMOVE(&wl->list, req, w_list);
 		DSL(0x20, SLT_Debug, sp->vsl_id, "off waiting list");
 		if (SES_Schedule(sp)) {
 			/*
diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h
index 5e05748..c385ea6 100644
--- a/bin/varnishd/hash/hash_slinger.h
+++ b/bin/varnishd/hash/hash_slinger.h
@@ -68,7 +68,7 @@ struct objcore *HSH_NewObjCore(struct worker *wrk);
 struct waitinglist {
 	unsigned		magic;
 #define WAITINGLIST_MAGIC	0x063a477a
-	VTAILQ_HEAD(, sess)	list;
+	VTAILQ_HEAD(, req)	list;
 };
 
 struct objhead {



More information about the varnish-commit mailing list