r5570 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Sun Nov 21 11:07:57 CET 2010


Author: phk
Date: 2010-11-21 11:07:57 +0100 (Sun, 21 Nov 2010)
New Revision: 5570

Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/cache_vrt_var.c
   trunk/varnish-cache/bin/varnishd/stevedore.c
Log:
Further marginalize usage of sp->objhead in preference of sp->objcore->objhead.



Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-11-21 09:54:15 UTC (rev 5569)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-11-21 10:07:57 UTC (rev 5570)
@@ -262,8 +262,8 @@
 
 /*--------------------------------------------------------------------
  * It evaluates if a backend is healthy _for_a_specific_object_.
- * That means that it relies on sp->objhead. This is mainly for saint-mode,
- * but also takes backend->healthy into account. If
+ * That means that it relies on sp->objcore->objhead. This is mainly for
+ * saint-mode, but also takes backend->healthy into account. If
  * params->saintmode_threshold is 0, this is basically just a test of
  * backend->healthy.
  *
@@ -272,7 +272,7 @@
  */
 
 static unsigned int
-vbe_Healthy(double now, uintptr_t target, const struct vdi_simple *vs)
+vbe_Healthy(const struct vdi_simple *vs, const struct sess *sp)
 {
 	struct trouble *tr;
 	struct trouble *tr2;
@@ -280,7 +280,10 @@
 	unsigned i = 0, retval;
 	unsigned int threshold;
 	struct backend *backend;
+	uintptr_t target;
+	double now;
 
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(vs, VDI_SIMPLE_MAGIC);
 	backend = vs->backend;
 	CHECK_OBJ_NOTNULL(backend, BACKEND_MAGIC);
@@ -300,12 +303,12 @@
 	if (threshold == 0)
 		return (1);
 
-	/* No need to test if we don't have an object head to test against.
-	 * FIXME: Should check the magic too, but probably not assert?
-	 */
-	if (target == 0)
+	if (sp->objcore == NULL) 
 		return (1);
 
+	now = sp->t_req;
+	target = (uintptr_t)(sp->objcore->objhead);
+
 	old = NULL;
 	retval = 1;
 	Lck_Lock(&backend->mtx);
@@ -392,7 +395,7 @@
 		VBE_ReleaseConn(vc);
 	}
 
-	if (!vbe_Healthy(sp->t_req, (uintptr_t)sp->objhead, vs)) {
+	if (!vbe_Healthy(vs, sp)) {
 		VSC_main->backend_unhealthy++;
 		return (NULL);
 	}
@@ -489,7 +492,7 @@
 
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
-	return (vbe_Healthy(sp->t_req, (uintptr_t)(sp->objhead), vs));
+	return (vbe_Healthy(vs, sp));
 }
 
 static void

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2010-11-21 09:54:15 UTC (rev 5569)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2010-11-21 10:07:57 UTC (rev 5570)
@@ -364,7 +364,6 @@
 
 	if (sp->objcore != NULL) {		/* pass has no objcore */
 		CHECK_OBJ_NOTNULL(sp->objcore, OBJCORE_MAGIC);
-		AN(sp->objhead);		/* details in hash_slinger.h */
 		AN(sp->objcore->flags & OC_F_BUSY);
 	}
 

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-11-21 09:54:15 UTC (rev 5569)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-11-21 10:07:57 UTC (rev 5570)
@@ -390,8 +390,9 @@
 	 * XXX: this until the object is unbusy'ed, so in practice we
 	 * XXX: serialize fetch of all Vary's if grace is possible.
 	 */
-	AZ(sp->objhead);
-	sp->objhead = oh;		/* XXX: Hack */
+
+	AZ(sp->objcore);
+	sp->objcore = grace_oc;		/* XXX: Hack-ish */
 	if (oc == NULL			/* We found no live object */
 	    && grace_oc != NULL		/* There is a grace candidate */
 	    && (busy_oc != NULL		/* Somebody else is already busy */
@@ -402,7 +403,7 @@
 		if (o->ttl + HSH_Grace(sp->grace) >= sp->t_req)
 			oc = grace_oc;
 	}
-	sp->objhead = NULL;
+	sp->objcore = NULL;
 
 	if (oc != NULL && !sp->hash_always_miss) {
 		o = oc_getobj(sp->wrk, oc);

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_var.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_var.c	2010-11-21 09:54:15 UTC (rev 5569)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_var.c	2010-11-21 10:07:57 UTC (rev 5570)
@@ -142,9 +142,9 @@
 	if (!sp->vbc->backend)
 		return;
 	CHECK_OBJ_NOTNULL(sp->vbc->backend, BACKEND_MAGIC);
-	if (!sp->objhead)
+	if (!sp->objcore)
 		return;
-	CHECK_OBJ_NOTNULL(sp->objhead, OBJHEAD_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->objcore, OBJCORE_MAGIC);
 
 	/* Setting a negative holdoff period is a mistake. Detecting this
 	 * when compiling the VCL would be better.
@@ -153,7 +153,7 @@
 
 	ALLOC_OBJ(new, TROUBLE_MAGIC);
 	AN(new);
-	new->target = (uintptr_t)sp->objhead;
+	new->target = (uintptr_t)(sp->objcore->objhead);
 	new->timeout = sp->t_req + a;
 
 	/* Insert the new item on the list before the first item with a

Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c	2010-11-21 09:54:15 UTC (rev 5569)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c	2010-11-21 10:07:57 UTC (rev 5570)
@@ -199,14 +199,12 @@
 	VTAILQ_INIT(&o->store);
 	sp->wrk->stats.n_object++;
 
-	if (sp->objhead != NULL) {
-		CHECK_OBJ_NOTNULL(sp->objhead, OBJHEAD_MAGIC);
+	if (sp->objcore != NULL) {
 		CHECK_OBJ_NOTNULL(sp->objcore, OBJCORE_MAGIC);
 
 		o->objcore = sp->objcore;
-		assert(o->objcore->objhead == sp->objhead);
 
-		sp->objhead = NULL;     /* refcnt follows pointer. */
+		sp->objhead = NULL;     /* XXX: refcnt follows pointer. */
 		sp->objcore = NULL;     /* refcnt follows pointer. */
 		BAN_NewObj(o);
 




More information about the varnish-commit mailing list