[master] 5d1770e Put the struct body in vfp_ctx

Poul-Henning Kamp phk at FreeBSD.org
Wed Jul 23 11:38:25 CEST 2014


commit 5d1770e1d082a443476d18b3e3c72efbaf0860fc
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jul 23 09:38:12 2014 +0000

    Put the struct body in vfp_ctx

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 8a3d0ae..f711959 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -104,6 +104,7 @@ enum {
 struct SHA256Context;
 struct VSC_C_lck;
 struct ban;
+struct body;
 struct busyobj;
 struct cli;
 struct cli_proto;
@@ -113,6 +114,7 @@ struct mempool;
 struct objcore;
 struct object;
 struct objhead;
+struct objiter;
 struct pool;
 struct poolparam;
 struct req;
@@ -124,7 +126,6 @@ struct vsb;
 struct waitinglist;
 struct worker;
 struct wrw;
-struct objiter;
 
 #define DIGEST_LEN		32
 
@@ -464,6 +465,7 @@ struct vfp_ctx {
 
 	struct vsl_log		*vsl;
 	struct http		*http;
+	struct body		*body;
 	uint64_t		bodybytes;
 };
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index ad0c168..e0320fc 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -480,6 +480,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 	assert(WRW_IsReleased(wrk));
 
 	obj = bo->fetch_obj;
+	bo->vfc->body = obj->body;
 
 	if (bo->do_gzip || (bo->is_gzip && !bo->do_gunzip))
 		obj->gziped = 1;
@@ -579,6 +580,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
 
 	AZ(vbf_beresp2obj(bo));
 	obj = bo->fetch_obj;
+	bo->vfc->body = obj->body;
 
 	if (bo->ims_obj->esidata != NULL) {
 		sl = bo->ims_obj->esidata->len;
@@ -711,6 +713,8 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
 	if (vbf_beresp2obj(bo))
 		return (F_STP_FAIL);
 
+	bo->vfc->body = bo->fetch_obj->body;
+
 	l = VSB_len(bo->synth_body);
 	if (l > 0) {
 		st = VFP_GetStorage(bo->vfc, l);
diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index 87d3b6d..14b26f2 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -78,13 +78,11 @@ VFP_GetStorage(struct vfp_ctx *vc, ssize_t sz)
 {
 	ssize_t l;
 	struct storage *st;
-	struct object *obj;
 
 	CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(vc->bo, BUSYOBJ_MAGIC);
-	obj = vc->bo->fetch_obj;
-	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
-	st = VTAILQ_LAST(&obj->body->list, storagehead);
+	AN(vc->body);
+	st = VTAILQ_LAST(&vc->body->list, storagehead);
 	if (st != NULL && st->len < st->space)
 		return (st);
 
@@ -100,7 +98,7 @@ VFP_GetStorage(struct vfp_ctx *vc, ssize_t sz)
 	} else {
 		AZ(st->len);
 		Lck_Lock(&vc->bo->mtx);
-		VTAILQ_INSERT_TAIL(&obj->body->list, st, list);
+		VTAILQ_INSERT_TAIL(&vc->body->list, st, list);
 		Lck_Unlock(&vc->bo->mtx);
 	}
 	return (st);



More information about the varnish-commit mailing list