[master] 295e99a Change "GONE" bans to "COMPLETED" bans.

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 12 16:18:38 CET 2013


commit 295e99af97886ee26ae653f1dd67312fcebfd464
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Dec 12 15:18:20 2013 +0000

    Change "GONE"  bans to "COMPLETED" bans.

diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index d1d0dbd..70ed654 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -41,7 +41,7 @@
  * Bans are compiled into bytestrings as follows:
  *	8 bytes	- double: timestamp		XXX: Byteorder ?
  *	4 bytes - be32: length
- *	1 byte - flags: 0x01: BAN_F_{REQ|OBJ|GONE}
+ *	1 byte - flags: 0x01: BAN_F_{REQ|OBJ|COMPLETED}
  *	N tests
  * A test have this form:
  *	1 byte - arg (see ban_vars.h col 3 "BANS_ARG_XXX")
@@ -88,7 +88,7 @@
 
 #define BANS_FLAG_REQ		(1<<0)
 #define BANS_FLAG_OBJ		(1<<1)
-#define BANS_FLAG_GONE		(1<<2)
+#define BANS_FLAG_COMPLETED	(1<<2)
 #define BANS_FLAG_HTTP		(1<<3)
 #define BANS_FLAG_ERROR		(1<<4)
 
@@ -268,7 +268,7 @@ ban_equal(const uint8_t *bs1, const uint8_t *bs2)
 }
 
 static void
-ban_mark_gone(struct ban *b)
+ban_mark_completed(struct ban *b)
 {
 	unsigned ln;
 
@@ -276,13 +276,13 @@ ban_mark_gone(struct ban *b)
 	Lck_AssertHeld(&ban_mtx);
 
 	AN(b->spec);
-	AZ(b->flags & BANS_FLAG_GONE);
+	AZ(b->flags & BANS_FLAG_COMPLETED);
 	ln = ban_len(b->spec);
-	b->flags |= BANS_FLAG_GONE;
-	b->spec[BANS_FLAGS] |= BANS_FLAG_GONE;
+	b->flags |= BANS_FLAG_COMPLETED;
+	b->spec[BANS_FLAGS] |= BANS_FLAG_COMPLETED;
 	VWMB();
 	vbe32enc(b->spec + BANS_LENGTH, BANS_HEAD_LEN);
-	VSC_C_main->bans_gone++;
+	VSC_C_main->bans_completed++;
 	VSC_C_main->bans_persisted_fragmentation += ln - ban_len(b->spec);
 }
 
@@ -555,16 +555,16 @@ BAN_Insert(struct ban *b)
 	if (be == NULL)
 		return (NULL);
 
-	/* Hunt down duplicates, and mark them as gone */
+	/* Hunt down duplicates, and mark them as completed */
 	bi = b;
 	Lck_Lock(&ban_mtx);
 	while(!ban_shutdown && bi != be) {
 		bi = VTAILQ_NEXT(bi, list);
-		if (bi->flags & BANS_FLAG_GONE)
+		if (bi->flags & BANS_FLAG_COMPLETED)
 			continue;
 		if (!ban_equal(b->spec, bi->spec))
 			continue;
-		ban_mark_gone(bi);
+		ban_mark_completed(bi);
 		VSC_C_main->bans_dups++;
 	}
 	be->refcount--;
@@ -671,7 +671,7 @@ ban_info(enum baninfo event, const uint8_t *ban, unsigned len)
 	if (STV_BanInfo(event, ban, len)) {
 		/* One or more stevedores reported failure. Export the
 		 * list instead. The exported list should take up less
-		 * space due to drops being purged and gones being
+		 * space due to drops being purged and completed being
 		 * truncated. */
 		/* XXX: Keep some measure of how much space can be
 		 * saved, and only export if it's worth it. Assert if
@@ -684,8 +684,8 @@ ban_info(enum baninfo event, const uint8_t *ban, unsigned len)
  * Put a skeleton ban in the list, unless there is an identical,
  * time & condition, ban already in place.
  *
- * If a newer ban has same condition, mark the new ban GONE.
- * mark any older bans, with the same condition, GONE as well.
+ * If a newer ban has same condition, mark the inserted ban COMPLETED,
+ * also mark any older bans, with the same condition COMPLETED.
  */
 
 static void
@@ -727,8 +727,8 @@ ban_reload(const uint8_t *ban, unsigned len)
 	}
 	if (duplicate)
 		VSC_C_main->bans_dups++;
-	if (duplicate || (ban[BANS_FLAGS] & BANS_FLAG_GONE))
-		ban_mark_gone(b2);
+	if (duplicate || (ban[BANS_FLAGS] & BANS_FLAG_COMPLETED))
+		ban_mark_completed(b2);
 	if (b == NULL)
 		VTAILQ_INSERT_TAIL(&ban_head, b2, list);
 	else
@@ -737,10 +737,10 @@ ban_reload(const uint8_t *ban, unsigned len)
 
 	/* Hunt down older duplicates */
 	for (b = VTAILQ_NEXT(b2, list); b != NULL; b = VTAILQ_NEXT(b, list)) {
-		if (b->flags & BANS_FLAG_GONE)
+		if (b->flags & BANS_FLAG_COMPLETED)
 			continue;
 		if (ban_equal(b->spec, ban)) {
-			ban_mark_gone(b);
+			ban_mark_completed(b);
 			VSC_C_main->bans_dups++;
 		}
 	}
@@ -927,7 +927,7 @@ ban_check_object(struct object *o, struct vsl_log *vsl,
 	tests = 0;
 	for (b = b0; b != oc->ban; b = VTAILQ_NEXT(b, list)) {
 		CHECK_OBJ_NOTNULL(b, BAN_MAGIC);
-		if (b->flags & BANS_FLAG_GONE)
+		if (b->flags & BANS_FLAG_COMPLETED)
 			continue;
 		if (ban_evaluate(b->spec, o->http, req_http, &tests))
 			break;
@@ -975,8 +975,8 @@ ban_cleantail(void)
 		Lck_Lock(&ban_mtx);
 		b = VTAILQ_LAST(&ban_head, banhead_s);
 		if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) {
-			if (b->flags & BANS_FLAG_GONE)
-				VSC_C_main->bans_gone--;
+			if (b->flags & BANS_FLAG_COMPLETED)
+				VSC_C_main->bans_completed--;
 			if (b->flags & BANS_FLAG_OBJ)
 				VSC_C_main->bans_obj--;
 			if (b->flags & BANS_FLAG_REQ)
@@ -1117,7 +1117,7 @@ ban_lurker_work(struct worker *wrk, struct vsl_log *vsl)
 	Lck_Unlock(&ban_mtx);
 	i = 0;
 	while (b != NULL) {
-		if (b->flags & BANS_FLAG_GONE) {
+		if (b->flags & BANS_FLAG_COMPLETED) {
 			;
 		} else if (b->flags & BANS_FLAG_REQ) {
 			;
@@ -1138,9 +1138,10 @@ ban_lurker_work(struct worker *wrk, struct vsl_log *vsl)
 	VTAILQ_FOREACH_REVERSE(bt, &ban_head, banhead_s, list) {
 		if (bt == VTAILQ_LAST(&obans, banhead_s)) {
 			if (DO_DEBUG(DBG_LURKER))
-				VSLb(vsl, SLT_Debug, "Lurk bt gone %p", bt);
+				VSLb(vsl, SLT_Debug,
+				    "Lurk bt completed %p", bt);
 			Lck_Lock(&ban_mtx);
-			ban_mark_gone(bt);
+			ban_mark_completed(bt);
 			Lck_Unlock(&ban_mtx);
 			VTAILQ_REMOVE(&obans, bt, l_list);
 			if (VTAILQ_EMPTY(&obans))
@@ -1283,9 +1284,9 @@ ccf_ban_list(struct cli *cli, const char * const *av, void *priv)
 
 	VCLI_Out(cli, "Present bans:\n");
 	VTAILQ_FOREACH(b, &ban_head, list) {
-		VCLI_Out(cli, "%10.6f %5u%s", ban_time(b->spec),
+		VCLI_Out(cli, "%10.6f %5u %s", ban_time(b->spec),
 		    bl == b ? b->refcount - 1 : b->refcount,
-		    b->flags & BANS_FLAG_GONE ? "G" : "-");
+		    b->flags & BANS_FLAG_COMPLETED ? "C" : " ");
 		if (DO_DEBUG(DBG_LURKER)) {
 			VCLI_Out(cli, "%s%s%s %p ",
 			    b->flags & BANS_FLAG_REQ ? "R" : "-",
@@ -1327,7 +1328,7 @@ BAN_Init(void)
 	AN(ban_magic);
 	AZ(BAN_Insert(ban_magic));
 	Lck_Lock(&ban_mtx);
-	ban_mark_gone(ban_magic);
+	ban_mark_completed(ban_magic);
 	Lck_Unlock(&ban_mtx);
 }
 
diff --git a/bin/varnishtest/tests/c00049.vtc b/bin/varnishtest/tests/c00049.vtc
index 3ca2b18..70620da 100644
--- a/bin/varnishtest/tests/c00049.vtc
+++ b/bin/varnishtest/tests/c00049.vtc
@@ -97,7 +97,7 @@ delay .1
 varnish v1 -cliok "ban.list"
 
 varnish v1 -expect bans == 6
-varnish v1 -expect bans_gone == 1
+varnish v1 -expect bans_completed == 1
 varnish v1 -expect bans_req == 1
 varnish v1 -expect bans_obj == 4
 varnish v1 -expect bans_added == 6
@@ -118,7 +118,7 @@ delay 2
 varnish v1 -cliok "ban.list"
 
 varnish v1 -expect bans == 5
-varnish v1 -expect bans_gone == 4
+varnish v1 -expect bans_completed == 4
 varnish v1 -expect bans_req == 1
 varnish v1 -expect bans_obj == 4
 varnish v1 -expect bans_added == 6
@@ -143,7 +143,7 @@ delay 1
 varnish v1 -cliok "ban.list"
 
 varnish v1 -expect bans == 4
-varnish v1 -expect bans_gone == 3
+varnish v1 -expect bans_completed == 3
 varnish v1 -expect bans_req == 1
 varnish v1 -expect bans_obj == 3
 varnish v1 -expect bans_added == 6
@@ -168,7 +168,7 @@ delay 1
 varnish v1 -cliok "ban.list"
 
 varnish v1 -expect bans == 1
-varnish v1 -expect bans_gone == 1
+varnish v1 -expect bans_completed == 1
 varnish v1 -expect bans_req == 0
 varnish v1 -expect bans_obj == 1
 varnish v1 -expect bans_added == 6
diff --git a/bin/varnishtest/tests/p00009.vtc b/bin/varnishtest/tests/p00009.vtc
index 47f216d..66b1e2f 100644
--- a/bin/varnishtest/tests/p00009.vtc
+++ b/bin/varnishtest/tests/p00009.vtc
@@ -1,4 +1,4 @@
-varnishtest "Check that reloaded bans with gone flag are really gone on restart"
+varnishtest "Check that reloaded bans with completed flag are really completed on restart"
 
 shell "rm -f ${tmpdir}/_.per[12]"
 
@@ -36,8 +36,8 @@ varnish v1 -expect bans == 3
 # Expect 1 of the 2 added to be marked dup
 varnish v1 -expect bans_dups == 1
 
-# Expect ban_magic plus our 1 dup to be marked gone
-varnish v1 -expect bans_gone == 2
+# Expect ban_magic plus our 1 dup to be marked completed
+varnish v1 -expect bans_completed == 2
 
 # Restart
 varnish v1 -stop
@@ -54,4 +54,4 @@ client c1 {
 # Expect our duplicate
 varnish v1 -expect bans_dups == 1
 # One more than before restart due to the new ban_magic
-varnish v1 -expect bans_gone == 3
+varnish v1 -expect bans_completed == 3
diff --git a/bin/varnishtest/tests/r01266.vtc b/bin/varnishtest/tests/r01266.vtc
index 04e3cb9..76352c3 100644
--- a/bin/varnishtest/tests/r01266.vtc
+++ b/bin/varnishtest/tests/r01266.vtc
@@ -1,6 +1,6 @@
-varnishtest "#1266 - Check persisted truncated gone bans"
+varnishtest "#1266 - Check persisted truncated completed bans"
 
-# Test that bans which has been gone'd, truncated and persisted works
+# Test that bans which has been completed, truncated and persisted works
 
 shell "rm -f ${tmpdir}/_.per1"
 
@@ -17,7 +17,7 @@ varnish v1 \
 	}
 varnish v1 -start
 
-# Add a ban that will (with lurker help) become a truncated gone ban last
+# Add a ban that will (with lurker help) become a truncated completed ban last
 # in the list
 varnish v1 -cliok "ban obj.http.x-foo == bar"
 delay 1
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
index 121eaae..32e3a62 100644
--- a/include/tbl/vsc_f_main.h
+++ b/include/tbl/vsc_f_main.h
@@ -485,8 +485,8 @@ VSC_F(bans,			uint64_t, 0, 'g', info,
 	"Number of all bans in system, including bans superseded"
 	" by newer bans and bans already checked by the ban-lurker."
 )
-VSC_F(bans_gone,		uint64_t, 0, 'g', diag,
-    "Number of bans marked 'gone'",
+VSC_F(bans_completed,		uint64_t, 0, 'g', diag,
+    "Number of bans marked 'completed'",
 	"Number of bans which are no longer active, either because they"
 	" got checked by the ban-lurker or superseded by newer identical bans."
 )
@@ -556,7 +556,7 @@ VSC_F(bans_persisted_bytes,	uint64_t, 0, 'g', diag,
 VSC_F(bans_persisted_fragmentation,	uint64_t, 0, 'g', diag,
     "Extra bytes in persisted ban lists due to fragmentation",
         "Number of extra bytes accumulated through dropped and"
-	" gone bans in the persistent ban lists."
+	" completed bans in the persistent ban lists."
 )
 
 /*--------------------------------------------------------------------*/



More information about the varnish-commit mailing list