[master] f918ddb Move the HTC from sess to req, that's another 64 bytes.

Poul-Henning Kamp phk at varnish-cache.org
Fri Dec 23 13:47:45 CET 2011


commit f918ddbfaaf2b8c449f6595331fcdc6664bada2f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Dec 23 12:47:32 2011 +0000

    Move the HTC from sess to req, that's another 64 bytes.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 578d548..bf4754b 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -615,6 +615,9 @@ struct req {
 	char			*ws_req;	/* WS above request data */
 
 	double			t_resp;
+
+	struct http_conn	htc[1];
+
 };
 
 /*--------------------------------------------------------------------*/
@@ -670,10 +673,6 @@ struct sess {
 	/* Timestamps, all on TIM_real() timescale */
 	double			t_req;
 
-	/* TBD fields ------------------------------------------------*/
-
-	struct http_conn	htc[1];
-
 };
 
 /* Prototypes etc ----------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 6eef7cb..b6d7a67 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -107,8 +107,12 @@ cnt_wait(struct sess *sp)
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	wrk = sp->wrk;
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	if (sp->req == NULL)
+	if (sp->req == NULL) {
 		SES_GetReq(sp);
+		HTC_Init(sp->req->htc, sp->ws, sp->fd, sp->vsl_id,
+		    cache_param->http_req_size,
+		    cache_param->http_req_hdr_len);
+	}
 
 	AZ(sp->req->vcl);
 	AZ(wrk->obj);
@@ -126,9 +130,9 @@ cnt_wait(struct sess *sp)
 		assert(j >= 0);
 		now = VTIM_real();
 		if (j != 0)
-			i = HTC_Rx(sp->htc);
+			i = HTC_Rx(sp->req->htc);
 		else
-			i = HTC_Complete(sp->htc);
+			i = HTC_Complete(sp->req->htc);
 		if (i == 1) {
 			/* Got it, run with it */
 			sp->t_req = now;
@@ -156,6 +160,8 @@ cnt_wait(struct sess *sp)
 				wrk->stats.sess_herd++;
 				SES_Charge(sp);
 				SES_ReleaseReq(sp);
+				WS_Release(sp->ws, 0);
+				WS_Reset(sp->ws, NULL);
 				WAIT_Enter(sp);
 				return (1);
 			}
@@ -445,14 +451,14 @@ cnt_done(struct sess *sp)
 	WS_Reset(sp->ws, NULL);
 	WS_Reset(wrk->ws, NULL);
 
-	i = HTC_Reinit(sp->htc);
+	i = HTC_Reinit(sp->req->htc);
 	if (i == 1) {
 		wrk->stats.sess_pipeline++;
 		sp->t_req = sp->t_idle;
 		sp->step = STP_START;
 		return (0);
 	}
-	if (Tlen(sp->htc->rxbuf))
+	if (Tlen(sp->req->htc->rxbuf))
 		wrk->stats.sess_readahead++;
 	sp->step = STP_WAIT;
 	sp->t_req = sp->t_idle;
@@ -1052,10 +1058,6 @@ cnt_first(struct sess *sp)
 		    sp->addr, sp->port, sp->mylsock->name);
 	}
 
-	/* Receive a HTTP protocol request */
-	HTC_Init(sp->htc, sp->ws, sp->fd, sp->vsl_id,
-	    cache_param->http_req_size,
-	    cache_param->http_req_hdr_len);
 	wrk->acct_tmp.sess++;
 
 	sp->step = STP_WAIT;
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 9f1d822..dbf30e6 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -345,7 +345,7 @@ FetchReqBody(struct sess *sp)
 				rdcnt = sizeof buf;
 			else
 				rdcnt = content_length;
-			rdcnt = HTC_Read(sp->wrk, sp->htc, buf, rdcnt);
+			rdcnt = HTC_Read(sp->wrk, sp->req->htc, buf, rdcnt);
 			if (rdcnt <= 0)
 				return (1);
 			content_length -= rdcnt;
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 803fed2..93bd896 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -658,7 +658,7 @@ http_DissectRequest(struct sess *sp)
 	uint16_t retval;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	htc = sp->htc;
+	htc = sp->req->htc;
 	CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
 	hp = sp->http;
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
diff --git a/bin/varnishd/cache/cache_pipe.c b/bin/varnishd/cache/cache_pipe.c
index 8bf76f3..a8282d7 100644
--- a/bin/varnishd/cache/cache_pipe.c
+++ b/bin/varnishd/cache/cache_pipe.c
@@ -82,9 +82,9 @@ PipeSession(struct sess *sp)
 	sp->wrk->acct_tmp.hdrbytes +=
 	    http_Write(w, sp->vsl_id, sp->wrk->busyobj->bereq, 0);
 
-	if (sp->htc->pipeline.b != NULL)
+	if (sp->req->htc->pipeline.b != NULL)
 		sp->wrk->acct_tmp.bodybytes +=
-		    WRW_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline));
+		    WRW_Write(w, sp->req->htc->pipeline.b, Tlen(sp->req->htc->pipeline));
 
 	i = WRW_FlushRelease(w);
 



More information about the varnish-commit mailing list