r4276 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Oct 6 10:10:38 CEST 2009


Author: phk
Date: 2009-10-06 10:10:38 +0200 (Tue, 06 Oct 2009)
New Revision: 4276

Modified:
   trunk/varnish-cache/bin/varnishd/storage_persistent.c
Log:
Align allocations to 16 bytes, for easier counting in hexdumps



Modified: trunk/varnish-cache/bin/varnishd/storage_persistent.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_persistent.c	2009-10-04 12:46:42 UTC (rev 4275)
+++ trunk/varnish-cache/bin/varnishd/storage_persistent.c	2009-10-06 08:10:38 UTC (rev 4276)
@@ -1312,6 +1312,12 @@
 	CAST_OBJ_NOTNULL(sc, st->priv, SMP_SC_MAGIC);
 	Lck_Lock(&sc->mtx);
 
+	/* Alignment */
+	if (size & 0xf) {
+		size |= 0xf;
+		size += 1;
+	}
+
 	for (tries = 0; tries < 3; tries++) {
 		sg = sc->cur_seg;
 		CHECK_OBJ_NOTNULL(sg, SMP_SEG_MAGIC);
@@ -1333,6 +1339,7 @@
 			size = left - overhead;
 			needed = overhead + size;
 			assert(needed <= left);
+			size &= ~15;
 		}
 
 		/* If there is space, fine */



More information about the varnish-commit mailing list