r4332 - branches/2.0/varnish-cache/bin/varnishd

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Oct 15 17:42:11 CEST 2009


Author: tfheen
Date: 2009-10-15 17:42:11 +0200 (Thu, 15 Oct 2009)
New Revision: 4332

Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache.h
   branches/2.0/varnish-cache/bin/varnishd/cache_ban.c
   branches/2.0/varnish-cache/bin/varnishd/cache_hash.c
Log:
Merge r4205: First part of ban list lurker

Do the simple part of ban list lurker: link the objcores off the bans
the reference.



Modified: branches/2.0/varnish-cache/bin/varnishd/cache.h
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-10-13 15:43:55 UTC (rev 4331)
+++ branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-10-15 15:42:11 UTC (rev 4332)
@@ -285,6 +285,7 @@
 
 	struct http		http[1];
 	VTAILQ_ENTRY(object)	list;
+	VTAILQ_ENTRY(object)	ban_list;
 
 	VTAILQ_HEAD(, storage)	store;
 

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_ban.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_ban.c	2009-10-13 15:43:55 UTC (rev 4331)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_ban.c	2009-10-15 15:42:11 UTC (rev 4332)
@@ -86,6 +86,7 @@
 	int			flags;
 #define BAN_F_GONE		(1 << 0)
 	VTAILQ_HEAD(,ban_test)	tests;
+	VTAILQ_HEAD(,object)	obj;
 };
 
 static VTAILQ_HEAD(banhead,ban) ban_head = VTAILQ_HEAD_INITIALIZER(ban_head);
@@ -103,6 +104,7 @@
 	if (b == NULL)
 		return (b);
 	VTAILQ_INIT(&b->tests);
+	VTAILQ_INIT(&b->obj);
 	return (b);
 }
 
@@ -146,6 +148,9 @@
 	struct ban_test *bt;
 
 	CHECK_OBJ_NOTNULL(b, BAN_MAGIC);
+	AZ(b->refcount);
+	assert(VTAILQ_EMPTY(&b->obj));
+
 	while (!VTAILQ_EMPTY(&b->tests)) {
 		bt = VTAILQ_FIRST(&b->tests);
 		VTAILQ_REMOVE(&b->tests, bt, list);
@@ -439,6 +444,7 @@
 	Lck_Lock(&ban_mtx);
 	o->ban = ban_start;
 	ban_start->refcount++;
+	VTAILQ_INSERT_TAIL(&ban_start->obj, o, ban_list);
 	Lck_Unlock(&ban_mtx);
 }
 
@@ -470,6 +476,7 @@
 	CHECK_OBJ_NOTNULL(o->ban, BAN_MAGIC);
 	Lck_Lock(&ban_mtx);
 	o->ban->refcount--;
+	VTAILQ_REMOVE(&o->ban->obj, o, ban_list);
 	o->ban = NULL;
 
 	/* Attempt to purge last ban entry */
@@ -518,8 +525,11 @@
 
 	Lck_Lock(&ban_mtx);
 	o->ban->refcount--;
-	if (b == o->ban)	/* not banned */
+	VTAILQ_REMOVE(&o->ban->obj, o, ban_list);
+	if (b == o->ban) {	/* not banned */
+		VTAILQ_INSERT_TAIL(&b0->obj, o, ban_list);
 		b0->refcount++;
+	}
 	VSL_stats->n_purge_obj_test++;
 	VSL_stats->n_purge_re_test += tests;
 	Lck_Unlock(&ban_mtx);

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_hash.c	2009-10-13 15:43:55 UTC (rev 4331)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_hash.c	2009-10-15 15:42:11 UTC (rev 4332)
@@ -460,7 +460,8 @@
 	if (r != 0)
 		return;
 
-	BAN_DestroyObj(o);
+	if (oh != NULL)
+		BAN_DestroyObj(o);
 	DSL(0x40, SLT_Debug, 0, "Object %u workspace min free %u",
 	    o->xid, WS_Free(o->ws_o));
 



More information about the varnish-commit mailing list