[experimental-ims] f222778 Eliminate the prepfetch state

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 18 10:27:45 CET 2014


commit f2227781d49de76a56955e69c13dde699dbbf4e0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Apr 30 07:35:27 2012 +0000

    Eliminate the prepfetch state

diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 4a04f5b..f963bbd 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -550,8 +550,8 @@ DOT		shape=record
 DOT		label="{cnt_fetch:|fetch hdr\nfrom backend|(find obj.ttl)|{vcl_fetch\{\}|{req.|bereq.|beresp.}}|{<err>error?|<rst>restart?}}"
 DOT	]
 DOT }
-DOT fetch -> prepfetch [style=bold,color=red]
-DOT fetch -> prepfetch [style=bold,color=blue]
+DOT fetch -> fetchbody [style=bold,color=red]
+DOT fetch -> fetchbody [style=bold,color=blue]
  */
 
 static int
@@ -630,7 +630,7 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
 
 		switch (req->handling) {
 		case VCL_RET_DELIVER:
-			sp->step = STP_PREPFETCH;
+			sp->step = STP_FETCHBODY;
 			return (0);
 		default:
 			break;
@@ -670,18 +670,17 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
  * Prepare to fetch body from backend
  *
 DOT subgraph xcluster_body {
-DOT	prepfetch [
+DOT	fetchbody [
 DOT		shape=record
-DOT		label="{cnt_prepfetch:|error?|<out>stream ?}"
+DOT		label="{cnt_fetchbody:|start fetch_thread}"
 DOT	]
 DOT }
-DOT prepfetch:out -> fetchbody [style=bold,color=red]
-DOT prepfetch:out -> fetchbody [style=bold,color=blue]
-DOT prepfetch:out -> prepresp [label=yes,style=bold,color=cyan]
+DOT fetchbody:out -> prepresp [style=bold,color=red]
+DOT fetchbody:out -> prepresp [style=bold,color=blue]
  */
 
 static int
-cnt_prepfetch(struct sess *sp, struct worker *wrk, struct req *req)
+cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
 {
 	struct http *hp, *hp2;
 	char *b;
@@ -868,34 +867,9 @@ cnt_prepfetch(struct sess *sp, struct worker *wrk, struct req *req)
 	    RFC2616_Do_Cond(sp))
 		bo->do_stream = 0;
 
-	sp->step = STP_FETCHBODY;
-	return (0);
-}
-
-/*--------------------------------------------------------------------
- * Actually fetch body from backend
- *
-DOT subgraph xcluster_fetchbody {
-DOT	fetchbody [
-DOT		shape=record
-DOT		label="{cnt_fetchbody:|error ?|<out>success ?}"
-DOT	]
-DOT }
-DOT fetchbody:out -> prepresp [style=bold,color=red]
-DOT fetchbody:out -> prepresp [style=bold,color=blue]
- */
-
-static int
-cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
-{
-	struct busyobj *bo;
-
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-	bo = req->busyobj;
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-
+	/*
+	 * Ready to fetch the body
+	 */
 	bo->fetch_task.func = FetchBody;
 	bo->fetch_task.priv = bo;
 
@@ -1707,5 +1681,3 @@ CNT_Init(void)
 	xids = random();
 	CLI_AddFuncs(debug_cmds);
 }
-
-
diff --git a/include/tbl/steps.h b/include/tbl/steps.h
index ee70874..15fd811 100644
--- a/include/tbl/steps.h
+++ b/include/tbl/steps.h
@@ -40,7 +40,6 @@ STEP(lookup,		LOOKUP,		(sp, sp->wrk, sp->req))
 STEP(miss,		MISS,		(sp, sp->wrk, sp->req))
 STEP(hit,		HIT,		(sp, sp->wrk, sp->req))
 STEP(fetch,		FETCH,		(sp, sp->wrk, sp->req))
-STEP(prepfetch,		PREPFETCH,	(sp, sp->wrk, sp->req))
 STEP(fetchbody,		FETCHBODY,	(sp, sp->wrk, sp->req))
 STEP(prepresp,		PREPRESP,	(sp, sp->wrk, sp->req))
 STEP(deliver,		DELIVER,	(sp, sp->wrk, sp->req))



More information about the varnish-commit mailing list