[master] 3063060 Reduce reliance on busyobj in preference of vfp_ctx.

Poul-Henning Kamp phk at FreeBSD.org
Wed Sep 3 12:10:35 CEST 2014


commit 3063060f4a47d62a9217ab9df5bd665a25ecf9c0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Sep 3 10:10:13 2014 +0000

    Reduce reliance on busyobj in preference of vfp_ctx.

diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index 3db8287..b44abd4 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -190,10 +190,13 @@ VFP_Fetch_Body(struct busyobj *bo)
 	uint8_t *ptr;
 	enum vfp_status vfps = VFP_ERROR;
 	ssize_t est;
+	struct vfp_ctx *vfc;
 
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	vfc = bo->vfc;
+	CHECK_OBJ_NOTNULL(vfc, VFP_CTX_MAGIC);
 
-	AN(bo->vfc->vfp_nxt);
+	AN(vfc->vfp_nxt);
 
 	est = bo->content_length;
 	if (est < 0)
@@ -206,23 +209,23 @@ VFP_Fetch_Body(struct busyobj *bo)
 			 * We don't fail the fetch, in order for hit-for-pass
 			 * objects to be created.
 			 */
-			AN(bo->fetch_objcore->flags & OC_F_PASS);
-			VSLb(bo->vsl, SLT_FetchError,
+			AN(vfc->oc->flags & OC_F_PASS);
+			VSLb(vfc->vsl, SLT_FetchError,
 			    "Pass delivery abandoned");
 			vfps = VFP_END;
 			bo->doclose = SC_RX_BODY;
 			break;
 		}
-		AZ(bo->vfc->failed);
+		AZ(vfc->failed);
 		l = est;
 		assert(l >= 0);
-		if (VFP_GetStorage(bo->vfc, &l, &ptr) != VFP_OK) {
+		if (VFP_GetStorage(vfc, &l, &ptr) != VFP_OK) {
 			bo->doclose = SC_RX_BODY;
 			break;
 		}
 
-		AZ(bo->vfc->failed);
-		vfps = VFP_Suck(bo->vfc, ptr, &l);
+		AZ(vfc->failed);
+		vfps = VFP_Suck(vfc, ptr, &l);
 		if (l > 0 && vfps != VFP_ERROR) {
 			VBO_extend(bo, l);
 			if (est >= l)
@@ -233,15 +236,15 @@ VFP_Fetch_Body(struct busyobj *bo)
 	} while (vfps == VFP_OK);
 
 	if (vfps == VFP_ERROR) {
-		AN(bo->vfc->failed);
-		(void)VFP_Error(bo->vfc, "Fetch Pipeline failed to process");
+		AN(vfc->failed);
+		(void)VFP_Error(vfc, "Fetch Pipeline failed to process");
 		bo->doclose = SC_RX_BODY;
 	}
 
-	vfp_suck_fini(bo->vfc);
+	vfp_suck_fini(vfc);
 
 	if (!bo->do_stream)
-		ObjTrimStore(bo->fetch_objcore, bo->stats);
+		ObjTrimStore(vfc->oc, bo->stats);
 }
 
 struct vfp_entry *



More information about the varnish-commit mailing list