[master] a9d35b4 Clarify comment, add assert + comment

Poul-Henning Kamp phk at varnish-cache.org
Sun Feb 19 08:44:23 CET 2012


commit a9d35b4759edc0034e1241ec47943bb18937a9db
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sun Feb 19 07:44:10 2012 +0000

    Clarify comment, add assert + comment

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 372ce08..a8b3dcb 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -572,9 +572,8 @@ FetchBody(struct worker *wrk, struct object *obj)
 	AZ(bo->vgz_rx);
 
 	/*
-	 * It is OK for ->end to just leave the last storage segment
-	 * sitting on wrk->storage, we will always call vfp_nop_end()
-	 * to get it trimmed or thrown out if empty.
+	 * We always call vfp_nop_end() to ditch or trim the last storage
+	 * segment, to avoid having to replicate that code in all vfp's.
 	 */
 	AZ(vfp_nop_end(bo));
 
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 2fce063..dd517be 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -177,6 +177,8 @@ stv_alloc(struct busyobj *bo, size_t size)
 	if (size > cache_param->fetch_maxchunksize)
 		size = cache_param->fetch_maxchunksize;
 
+	assert(size <= UINT_MAX);	/* field limit in struct storage */
+
 	for (;;) {
 		/* try to allocate from it */
 		AN(stv->alloc);



More information about the varnish-commit mailing list