r4718 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Fri Apr 23 23:09:30 CEST 2010


Author: phk
Date: 2010-04-23 23:09:29 +0200 (Fri, 23 Apr 2010)
New Revision: 4718

Modified:
   trunk/varnish-cache/bin/varnishd/hash_critbit.c
Log:
Add more "volatile" to make it clear to the compiler what we mean here.



Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-04-23 05:16:33 UTC (rev 4717)
+++ trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-04-23 21:09:29 UTC (rev 4718)
@@ -93,18 +93,17 @@
  */
 
 struct hcb_y {
-	unsigned short	critbit;
-	unsigned char	ptr;
-	unsigned char	bitmask;
-	uintptr_t	leaf[2];
+	unsigned short		critbit;
+	unsigned char		ptr;
+	unsigned char		bitmask;
+	volatile uintptr_t	leaf[2];
 };
 
 #define HCB_BIT_NODE		(1<<0)
 #define HCB_BIT_Y		(1<<1)
 
 struct hcb_root {
-	uintptr_t	origo;
-	unsigned	cmps;
+	volatile uintptr_t	origo;
 };
 
 static struct hcb_root	hcb_root;
@@ -209,7 +208,6 @@
 		assert(y->ptr < DIGEST_LEN);
 		s = (oh->digest[y->ptr] & y->bitmask) != 0;
 		assert(s < 2);
-		root->cmps++;
 		p = &y->leaf[s];
 		pp = *p;
 	}
@@ -246,7 +244,6 @@
 		assert(y->ptr < DIGEST_LEN);
 		s = (oh->digest[y->ptr] & y->bitmask) != 0;
 		assert(s < 2);
-		root->cmps++;
 		p = &y->leaf[s];
 	}
 	y2->leaf[s2] = *p;
@@ -260,7 +257,7 @@
 hcb_delete(struct hcb_root *r, struct objhead *oh)
 {
 	struct hcb_y *y;
-	uintptr_t *p;
+	volatile uintptr_t *p;
 	unsigned s;
 
 	if (r->origo == hcb_r_node(oh)) {
@@ -283,7 +280,6 @@
 			y->leaf[1] = 0;
 			return;
 		}
-		r->cmps++;
 		p = &y->leaf[s];
 	}
 }




More information about the varnish-commit mailing list