[master] 672fb60 Move vgz_rx from worker to busyobj

Poul-Henning Kamp phk at varnish-cache.org
Tue Nov 29 18:55:47 CET 2011


commit 672fb604cd38bb81a8d65c5b1c24d7bfc019fdf9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 29 17:55:25 2011 +0000

    Move vgz_rx from worker to busyobj

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 8cffdef..7a0167c 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -334,7 +334,6 @@ struct worker {
 	struct vbc		*vbc;
 	struct object		*fetch_obj;
 	enum body_status	body_status;
-	struct vgz		*vgz_rx;
 	struct vef_priv		*vef_priv;
 	unsigned		do_stream;
 	unsigned		do_esi;
@@ -503,6 +502,7 @@ struct busyobj {
 	struct vfp		*vfp;
 	struct vep_state	*vep;
 	unsigned		fetch_failed;
+	struct vgz		*vgz_rx;
 };
 
 /* Object structure --------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_esi_fetch.c b/bin/varnishd/cache/cache_esi_fetch.c
index b23538c..3dbc5ce 100644
--- a/bin/varnishd/cache/cache_esi_fetch.c
+++ b/bin/varnishd/cache/cache_esi_fetch.c
@@ -102,7 +102,7 @@ vfp_esi_bytes_gu(struct worker *w, struct http_conn *htc, ssize_t bytes)
 	const void *dp;
 
 	CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
-	vg = w->vgz_rx;
+	vg = w->busyobj->vgz_rx;
 
 	while (bytes > 0) {
 		if (VGZ_IbufEmpty(vg) && bytes > 0) {
@@ -264,10 +264,10 @@ vfp_esi_bytes_gg(struct worker *w, struct http_conn *htc, size_t bytes)
 		bytes -= wl;
 
 		vef->bufp = ibuf;
-		VGZ_Ibuf(w->vgz_rx, ibuf, wl);
+		VGZ_Ibuf(w->busyobj->vgz_rx, ibuf, wl);
 		do {
-			VGZ_Obuf(w->vgz_rx, ibuf2, sizeof ibuf2);
-			i = VGZ_Gunzip(w->vgz_rx, &dp, &dl);
+			VGZ_Obuf(w->busyobj->vgz_rx, ibuf2, sizeof ibuf2);
+			i = VGZ_Gunzip(w->busyobj->vgz_rx, &dp, &dl);
 			/* XXX: check i */
 			assert(i >= VGZ_OK);
 			vef->bufp = ibuf2;
@@ -284,7 +284,7 @@ vfp_esi_bytes_gg(struct worker *w, struct http_conn *htc, size_t bytes)
 				    vef->bufp, dl);
 				vef->npend += dl;
 			}
-		} while (!VGZ_IbufEmpty(w->vgz_rx));
+		} while (!VGZ_IbufEmpty(w->busyobj->vgz_rx));
 	}
 	return (1);
 }
@@ -300,9 +300,9 @@ vfp_esi_begin(struct worker *w, size_t estimate)
 	CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(w->busyobj, BUSYOBJ_MAGIC);
 
-	AZ(w->vgz_rx);
+	AZ(w->busyobj->vgz_rx);
 	if (w->busyobj->is_gzip && w->do_gunzip) {
-		w->vgz_rx = VGZ_NewUngzip(w, "U F E");
+		w->busyobj->vgz_rx = VGZ_NewUngzip(w, "U F E");
 		VEP_Init(w, NULL);
 	} else if (w->busyobj->is_gunzip && w->do_gzip) {
 		ALLOC_OBJ(vef, VEF_MAGIC);
@@ -312,7 +312,7 @@ vfp_esi_begin(struct worker *w, size_t estimate)
 		w->vef_priv = vef;
 		VEP_Init(w, vfp_vep_callback);
 	} else if (w->busyobj->is_gzip) {
-		w->vgz_rx = VGZ_NewUngzip(w, "U F E");
+		w->busyobj->vgz_rx = VGZ_NewUngzip(w, "U F E");
 		ALLOC_OBJ(vef, VEF_MAGIC);
 		AN(vef);
 		vef->vgz = VGZ_NewGzip(w, "G F E");
@@ -362,7 +362,8 @@ vfp_esi_end(struct worker *w)
 
 	retval = w->busyobj->fetch_failed;
 
-	if (w->vgz_rx != NULL && VGZ_Destroy(&w->vgz_rx, -1) != VGZ_END)
+	if (w->busyobj->vgz_rx != NULL &&
+	     VGZ_Destroy(&w->busyobj->vgz_rx, -1) != VGZ_END)
 		retval = FetchError(w,
 		    "Gunzip+ESI Failed at the very end");
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 895a5cb..2a2de5b 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -499,7 +499,7 @@ FetchBody(struct worker *w, struct object *obj)
 
 	AssertObjCorePassOrBusy(obj->objcore);
 
-	AZ(w->vgz_rx);
+	AZ(w->busyobj->vgz_rx);
 	AZ(VTAILQ_FIRST(&obj->store));
 
 	w->fetch_obj = obj;
@@ -547,7 +547,7 @@ FetchBody(struct worker *w, struct object *obj)
 		mklen = 0;
 		INCOMPL();
 	}
-	AZ(w->vgz_rx);
+	AZ(w->busyobj->vgz_rx);
 
 	/*
 	 * It is OK for ->end to just leave the last storage segment
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index a175fdf..f325292 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -457,8 +457,8 @@ static void __match_proto__()
 vfp_gunzip_begin(struct worker *w, size_t estimate)
 {
 	(void)estimate;
-	AZ(w->vgz_rx);
-	w->vgz_rx = VGZ_NewUngzip(w, "U F -");
+	AZ(w->busyobj->vgz_rx);
+	w->busyobj->vgz_rx = VGZ_NewUngzip(w, "U F -");
 }
 
 static int __match_proto__()
@@ -472,7 +472,7 @@ vfp_gunzip_bytes(struct worker *w, struct http_conn *htc, ssize_t bytes)
 	const void *dp;
 
 	AZ(w->busyobj->fetch_failed);
-	vg = w->vgz_rx;
+	vg = w->busyobj->vgz_rx;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	AZ(vg->vz.avail_in);
 	while (bytes > 0 || vg->vz.avail_in > 0) {
@@ -505,8 +505,8 @@ vfp_gunzip_end(struct worker *w)
 {
 	struct vgz *vg;
 
-	vg = w->vgz_rx;
-	w->vgz_rx = NULL;
+	vg = w->busyobj->vgz_rx;
+	w->busyobj->vgz_rx = NULL;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	if (w->busyobj->fetch_failed) {
 		(void)VGZ_Destroy(&vg, -1);
@@ -535,8 +535,8 @@ vfp_gzip_begin(struct worker *w, size_t estimate)
 {
 	(void)estimate;
 
-	AZ(w->vgz_rx);
-	w->vgz_rx = VGZ_NewGzip(w, "G F -");
+	AZ(w->busyobj->vgz_rx);
+	w->busyobj->vgz_rx = VGZ_NewGzip(w, "G F -");
 }
 
 static int __match_proto__()
@@ -550,7 +550,7 @@ vfp_gzip_bytes(struct worker *w, struct http_conn *htc, ssize_t bytes)
 	const void *dp;
 
 	AZ(w->busyobj->fetch_failed);
-	vg = w->vgz_rx;
+	vg = w->busyobj->vgz_rx;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	AZ(vg->vz.avail_in);
 	while (bytes > 0 || !VGZ_IbufEmpty(vg)) {
@@ -583,9 +583,9 @@ vfp_gzip_end(struct worker *w)
 	const void *dp;
 	int i;
 
-	vg = w->vgz_rx;
+	vg = w->busyobj->vgz_rx;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
-	w->vgz_rx = NULL;
+	w->busyobj->vgz_rx = NULL;
 	if (w->busyobj->fetch_failed) {
 		(void)VGZ_Destroy(&vg, -1);
 		return(0);
@@ -622,8 +622,8 @@ static void __match_proto__()
 vfp_testgzip_begin(struct worker *w, size_t estimate)
 {
 	(void)estimate;
-	w->vgz_rx = VGZ_NewUngzip(w, "u F -");
-	CHECK_OBJ_NOTNULL(w->vgz_rx, VGZ_MAGIC);
+	w->busyobj->vgz_rx = VGZ_NewUngzip(w, "u F -");
+	CHECK_OBJ_NOTNULL(w->busyobj->vgz_rx, VGZ_MAGIC);
 }
 
 static int __match_proto__()
@@ -638,7 +638,7 @@ vfp_testgzip_bytes(struct worker *w, struct http_conn *htc, ssize_t bytes)
 	struct storage *st;
 
 	AZ(w->busyobj->fetch_failed);
-	vg = w->vgz_rx;
+	vg = w->busyobj->vgz_rx;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	AZ(vg->vz.avail_in);
 	while (bytes > 0) {
@@ -677,8 +677,8 @@ vfp_testgzip_end(struct worker *w)
 {
 	struct vgz *vg;
 
-	vg = w->vgz_rx;
-	w->vgz_rx = NULL;
+	vg = w->busyobj->vgz_rx;
+	w->busyobj->vgz_rx = NULL;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	if (w->busyobj->fetch_failed) {
 		(void)VGZ_Destroy(&vg, -1);



More information about the varnish-commit mailing list