r5648 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Fri Dec 17 14:49:19 CET 2010


Author: phk
Date: 2010-12-17 14:49:17 +0100 (Fri, 17 Dec 2010)
New Revision: 5648

Modified:
   trunk/varnish-cache/bin/varnishd/stevedore.c
Log:
Confine objects to one stevedore.

We will no longer allow an object to be split across multiple
stevedores, because the necessary logic to allow control of which
stevedores allow this (malloc, file) vs. those that cannot tolerate
this (persistent) is just not worth the effort.

It is very dubious if there are any non-disadvantages to splitting
objects across stevedores in the first place.



Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c	2010-12-17 13:45:04 UTC (rev 5647)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c	2010-12-17 13:49:17 UTC (rev 5648)
@@ -113,15 +113,13 @@
 	if (sp->obj != NULL) {
 		CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
 		stv = sp->obj->objstore->stevedore;
-		CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC);
+	} else {
+		INCOMPL();
+		stv = stv_transient;
 	}
+	CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC);
 
 	for (;;) {
-		if (stv == NULL) {
-			stv = stv_pick_stevedore();
-			fail = 0;
-		}
-
 		/* try to allocate from it */
 		AN(stv->alloc);
 		st = stv->alloc(stv, size);
@@ -133,8 +131,8 @@
 			break;
 
 		/* Enough is enough: try another if we have one */
-		if (++fail == 50)
-			stv = NULL;
+		if (++fail == 50)	/* XXX Param */
+			break;
 	}
 	CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
 	return (st);
@@ -233,7 +231,11 @@
 	return (o);
 }
 
-/*-------------------------------------------------------------------*/
+/*-------------------------------------------------------------------
+ * Allocate storage for an object, based on the header information.
+ * XXX: If we know (a hint of) the length, we should allocate space
+ * XXX: for the body in the same allocation while we are at it.
+ */
 
 struct object *
 STV_NewObject(struct sess *sp, unsigned wsl, double ttl, unsigned nhttp)
@@ -249,6 +251,7 @@
 	lhttp = HTTP_estimate(nhttp);
 	lhttp = PRNDUP(lhttp);
 
+	memset(&soc, 0, sizeof soc);
 	soc.magic = STV_OBJ_SECRETES_MAGIC;
 	soc.nhttp = nhttp;
 	soc.lhttp = lhttp;




More information about the varnish-commit mailing list