r327 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Jul 5 15:09:01 CEST 2006


Author: phk
Date: 2006-07-05 15:09:01 +0200 (Wed, 05 Jul 2006)
New Revision: 327

Modified:
   trunk/varnish-cache/bin/varnishd/storage_file.c
Log:
Some asserts to guard against trouble.


Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2006-07-05 12:17:48 UTC (rev 326)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2006-07-05 13:09:01 UTC (rev 327)
@@ -268,10 +268,9 @@
 {
 	struct smf *sp, *sp2;
 
-	TAILQ_FOREACH(sp, &sc->free, status) {
+	TAILQ_FOREACH(sp, &sc->free, status)
 		if (sp->size >= bytes)
 			break;
-	}
 	if (sp == NULL)
 		return (sp);
 
@@ -478,6 +477,7 @@
 	size &= ~(sc->pagesize - 1);
 	AZ(pthread_mutex_lock(&sc->mtx));
 	smf = alloc_smf(sc, size);
+	assert(smf->size == size);
 	AZ(pthread_mutex_unlock(&sc->mtx));
 	assert(smf != NULL);
 	smf->s.space = size;
@@ -506,6 +506,7 @@
 	if (smf->size > size) {
 		AZ(pthread_mutex_lock(&sc->mtx));
 		trim_smf(smf, size);
+		assert(smf->size == size);
 		AZ(pthread_mutex_unlock(&sc->mtx));
 		smf->s.space = size;
 	}




More information about the varnish-commit mailing list