[experimental-ims] ac1e367 Move the setup/teardown of requests vary prediction space from cache_hash to cache_center.

Geoff Simmons geoff at varnish-cache.org
Fri Jul 8 11:47:45 CEST 2011


commit ac1e3675fe4e573315bc2c4874869c298b206b9d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jun 22 08:34:46 2011 +0000

    Move the setup/teardown of requests vary prediction space from
    cache_hash to cache_center.

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 4a17c56..5b55d58 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -1028,13 +1028,28 @@ cnt_lookup(struct sess *sp)
 	struct objcore *oc;
 	struct object *o;
 	struct objhead *oh;
+	struct worker *wrk;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
 
 
+	wrk = sp->wrk;
+	AZ(wrk->vary_b);
+	AZ(wrk->vary_l);
+	AZ(wrk->vary_e);
+	(void)WS_Reserve(wrk->ws, 0);
+	wrk->vary_b = (void*)wrk->ws->f;
+	wrk->vary_e = (void*)wrk->ws->r;
+	wrk->vary_b[2] = '\0';
+
 	oc = HSH_Lookup(sp, &oh);
 
+	WS_Release(wrk->ws, 0);
+	wrk->vary_b = NULL;
+	wrk->vary_l = NULL;
+	wrk->vary_e = NULL;
+
 	if (oc == NULL) {
 		/*
 		 * We lost the session to a busy object, disembark the
diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 0324b57..2a6dcc5 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -330,13 +330,6 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
 	}
 
 	CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
-	AZ(sp->wrk->vary_b);
-	AZ(sp->wrk->vary_l);
-	AZ(sp->wrk->vary_e);
-	WS_Reserve(sp->wrk->ws, 0);
-	sp->wrk->vary_b = (void*)sp->wrk->ws->f;
-	sp->wrk->vary_e = (void*)sp->wrk->ws->r;
-	sp->wrk->vary_b[2] = '\0';
 	Lck_Lock(&oh->mtx);
 	assert(oh->refcnt > 0);
 	busy_oc = NULL;
@@ -381,11 +374,6 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
 		}
 	}
 
-	WS_ReleaseP(sp->wrk->ws, (void*)sp->wrk->vary_b);
-	sp->wrk->vary_b = NULL;
-	sp->wrk->vary_l = NULL;
-	sp->wrk->vary_e = NULL;
-
 	/*
 	 * If we have seen a busy object or the backend is unhealthy, and
 	 * we have an object in grace, use it, if req.grace is also



More information about the varnish-commit mailing list