[master] 42f4e95 Give the expiry thread its own VSL, and get rid of WSL() entirely.

Poul-Henning Kamp phk at varnish-cache.org
Mon Feb 20 09:30:49 CET 2012


commit 42f4e9572cf14ca2b1e385e4b4e487475fb1e15d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 20 08:30:33 2012 +0000

    Give the expiry thread its own VSL, and get rid of WSL() entirely.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index bba390e..028abe9 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -915,8 +915,6 @@ void VSM_Free(void *ptr);
 #ifdef VSL_ENDMARKER
 void VSL(enum VSL_tag_e tag, int id, const char *fmt, ...)
     __printflike(3, 4);
-void WSL(struct vsl_log *, enum VSL_tag_e tag, int id, const char *fmt, ...)
-    __printflike(4, 5);
 void VSLb(struct vsl_log *, enum VSL_tag_e tag, const char *fmt, ...)
     __printflike(3, 4);
 void VSLbt(struct vsl_log *, enum VSL_tag_e tag, txt t);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 8eedb71..98b664f 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -336,13 +336,15 @@ exp_timer(struct worker *wrk, void *priv)
 	struct lru *lru;
 	double t;
 	struct object *o;
+	struct vsl_log vsl;
 
 	(void)priv;
+	VSL_Setup(&vsl, NULL, 0);
 	t = VTIM_real();
 	oc = NULL;
 	while (1) {
 		if (oc == NULL) {
-			VSL_Flush(wrk->vsl, 0);
+			VSL_Flush(&vsl, 0);
 			WRK_SumStat(wrk);
 			VTIM_sleep(cache_param->expiry_sleep);
 			t = VTIM_real();
@@ -400,7 +402,7 @@ exp_timer(struct worker *wrk, void *priv)
 
 		CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
 		o = oc_getobj(&wrk->stats, oc);
-		WSL(wrk->vsl, SLT_ExpKill, 0, "%u %.0f",
+		VSLb(&vsl, SLT_ExpKill, "%u %.0f",
 		    oc_getxid(&wrk->stats, oc), EXP_Ttl(NULL, o) - t);
 		(void)HSH_Deref(&wrk->stats, oc, NULL);
 	}
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index 6a54101..bcdfa6d 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -274,22 +274,6 @@ wsl(struct vsl_log *vsl, enum VSL_tag_e tag, int id, const char *fmt, va_list ap
 		VSL_Flush(vsl, 0);
 }
 
-/*--------------------------------------------------------------------*/
-
-void
-WSL(struct vsl_log *vsl, enum VSL_tag_e tag, int id, const char *fmt, ...)
-{
-	va_list ap;
-
-	if (id == -1)
-		id = vsl->wid;
-	AN(fmt);
-	va_start(ap, fmt);
-	wsl(vsl, tag, id, fmt, ap);
-	va_end(ap);
-}
-
-
 /*--------------------------------------------------------------------
  * VSL-buffered
  */
@@ -320,6 +304,12 @@ VSLbt(struct vsl_log *vsl, enum VSL_tag_e tag, txt t)
 void
 VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len)
 {
+
+	if (ptr == NULL) {
+		len = cache_param->vsl_buffer;
+		ptr = malloc(len);
+		AN(ptr);
+	}
 	vsl->wlp = ptr;
 	vsl->wlb = ptr;
 	vsl->wle = ptr;



More information about the varnish-commit mailing list