[master] d86979e Emit SLT__Batch records which tells us that the next N bytes all belong to the same batch of VSL records and therefore have the same vxid.

Poul-Henning Kamp phk at varnish-cache.org
Tue Nov 20 09:12:58 CET 2012


commit d86979e07896e6f3a05e36847eb8439a1e79c552
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 20 08:10:44 2012 +0000

    Emit SLT__Batch records which tells us that the next N bytes all
    belong to the same batch of VSL records and therefore have the
    same vxid.
    
    This will allow us to optimize libvarnishapi, in particular when
    doing ordered/transaction mode.

diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index a741035..23add4f 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -217,11 +217,12 @@ VSL_Flush(struct vsl_log *vsl, int overflow)
 
 	assert(l >= 8);
 
-	p = vsl_get(l - 8, vsl->wlr, overflow);
+	p = vsl_get(l, vsl->wlr, overflow);
 
-	memcpy(p + 1, vsl->wlb + 1, l - 4);
+	memcpy(p + 2, vsl->wlb, l);
+	p[1] = l;
 	VWMB();
-	p[0] = vsl->wlb[0];
+	p[0] = ((((unsigned)SLT__Batch & 0xff) << 24) | 0);
 	vsl->wlp = vsl->wlb;
 	vsl->wlr = 0;
 }
diff --git a/include/vapi/vsl_int.h b/include/vapi/vsl_int.h
index 012a975..d50f9fc 100644
--- a/include/vapi/vsl_int.h
+++ b/include/vapi/vsl_int.h
@@ -80,7 +80,8 @@ enum VSL_tag_e {
 #define SLTM(foo,sdesc,ldesc)	SLT_##foo,
 #include "tbl/vsl_tags.h"
 #undef SLTM
-	SLT__Reserved = 255
+	SLT__Reserved = 254,
+	SLT__Batch = 255
 };
 
 #endif /* VAPI_VSL_FMT_H_INCLUDED */
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 1c36b3f..cb9e6eb 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -270,7 +270,9 @@ VSL_NextSLT(struct VSM_data *vd, uint32_t **pp, uint64_t *bits)
 		}
 
 		t = VSL_TAG(p);
-		if (vbit_test(vsl->vbm_select, t)) {
+		if (t == SLT__Batch) {
+			continue;
+		} else if (vbit_test(vsl->vbm_select, t)) {
 			/* nothing */
 		} else if (vbit_test(vsl->vbm_supress, t)) {
 			continue;



More information about the varnish-commit mailing list