[experimental-ims] 2608703 Give WRW a hint about which vsl to log to.

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


commit 2608703ba1891b61de94074489b03bfa4a91165a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 20 08:11:52 2012 +0000

    Give WRW a hint about which vsl to log to.
    
    Consequent Constification

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 4b5fcd8..bba390e 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -773,7 +773,7 @@ void VGZ_UpdateObj(const struct vgz*, struct object *);
 int VGZ_WrwInit(struct vgz *vg);
 int VGZ_WrwGunzip(struct worker *w, struct vgz *, const void *ibuf,
     ssize_t ibufl);
-void VGZ_WrwFlush(struct worker *wrk, struct vgz *vg);
+void VGZ_WrwFlush(const struct worker *wrk, struct vgz *vg);
 
 /* Return values */
 #define VGZ_ERROR	-1
@@ -789,7 +789,7 @@ const char *http_StatusMessage(unsigned);
 unsigned http_EstimateWS(const struct http *fm, unsigned how, uint16_t *nhd);
 void HTTP_Init(void);
 void http_ClrHeader(struct http *to);
-unsigned http_Write(struct worker *w, const struct http *hp, int resp);
+unsigned http_Write(const struct worker *w, const struct http *hp, int resp);
 void http_SetResp(struct http *to, const char *proto, uint16_t status,
     const char *response);
 void http_FilterReq(const struct sess *sp, unsigned how);
@@ -885,13 +885,13 @@ int Pool_Task(struct pool *pp, struct pool_task *task, enum pool_how how);
 
 #define WRW_IsReleased(w)	((w)->wrw == NULL)
 int WRW_Error(const struct worker *w);
-void WRW_Chunked(struct worker *w);
-void WRW_EndChunk(struct worker *w);
-void WRW_Reserve(struct worker *w, int *fd, double t0);
-unsigned WRW_Flush(struct worker *w);
+void WRW_Chunked(const struct worker *w);
+void WRW_EndChunk(const struct worker *w);
+void WRW_Reserve(struct worker *w, int *fd, struct vsl_log *, double t0);
+unsigned WRW_Flush(const struct worker *w);
 unsigned WRW_FlushRelease(struct worker *w);
-unsigned WRW_Write(struct worker *w, const void *ptr, int len);
-unsigned WRW_WriteH(struct worker *w, const txt *hh, const char *suf);
+unsigned WRW_Write(const struct worker *w, const void *ptr, int len);
+unsigned WRW_WriteH(const struct worker *w, const txt *hh, const char *suf);
 
 /* cache_session.c [SES] */
 void SES_Close(struct sess *sp, const char *reason);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 00279c2..2d697cb 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -113,7 +113,7 @@ ved_include(struct sess *sp, const char *src, const char *host)
 	WS_Reset(sp->req->ws, sp_ws_wm);
 	WS_Reset(w->aws, wrk_ws_wm);	/* XXX ? */
 
-	WRW_Reserve(sp->wrk, &sp->fd, sp->req->t_resp);
+	WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp);
 	if (sp->req->res_mode & RES_CHUNKED)
 		WRW_Chunked(sp->wrk);
 }
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 24abc7a..05ac8a3 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -428,7 +428,7 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
 		VDI_AddHostHeader(bo->bereq, vc);
 
 	(void)VTCP_blocking(vc->fd);	/* XXX: we should timeout instead */
-	WRW_Reserve(wrk, &vc->fd, sp->t_req);	/* XXX t_resp ? */
+	WRW_Reserve(wrk, &vc->fd, bo->vsl, sp->t_req);	/* XXX t_resp ? */
 	(void)http_Write(wrk, hp, 0);	/* XXX: stats ? */
 
 	/* Deal with any message-body the request might have */
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index d4511bc..ec1b7cd 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -356,7 +356,7 @@ VGZ_WrwGunzip(struct worker *wrk, struct vgz *vg, const void *ibuf,
 /*--------------------------------------------------------------------*/
 
 void
-VGZ_WrwFlush(struct worker *wrk, struct vgz *vg)
+VGZ_WrwFlush(const struct worker *wrk, struct vgz *vg)
 {
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 02ab94f..4d2a9fa 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -1061,7 +1061,7 @@ HTTP_Copy(struct http *to, const struct http * const fm)
 /*--------------------------------------------------------------------*/
 
 unsigned
-http_Write(struct worker *w, const struct http *hp, int resp)
+http_Write(const struct worker *w, const struct http *hp, int resp)
 {
 	unsigned u, l;
 
diff --git a/bin/varnishd/cache/cache_pipe.c b/bin/varnishd/cache/cache_pipe.c
index 3f7cadf..8815c68 100644
--- a/bin/varnishd/cache/cache_pipe.c
+++ b/bin/varnishd/cache/cache_pipe.c
@@ -80,7 +80,7 @@ PipeSession(struct sess *sp)
 	bo->vbc = vc;		/* For panic dumping */
 	(void)VTCP_blocking(vc->fd);
 
-	WRW_Reserve(wrk, &vc->fd, sp->t_req);
+	WRW_Reserve(wrk, &vc->fd, bo->vsl, sp->t_req);
 	sp->wrk->acct_tmp.hdrbytes +=
 	    http_Write(wrk, bo->bereq, 0);
 
diff --git a/bin/varnishd/cache/cache_response.c b/bin/varnishd/cache/cache_response.c
index f1e0553..5a33d08 100644
--- a/bin/varnishd/cache/cache_response.c
+++ b/bin/varnishd/cache/cache_response.c
@@ -237,7 +237,7 @@ RES_WriteObj(struct sess *sp)
 	req = sp->req;
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
-	WRW_Reserve(sp->wrk, &sp->fd, sp->req->t_resp);
+	WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp);
 
 	if (req->obj->response == 200 &&
 	    req->http->conds &&
diff --git a/bin/varnishd/cache/cache_wrw.c b/bin/varnishd/cache/cache_wrw.c
index a8140f5..3a38305 100644
--- a/bin/varnishd/cache/cache_wrw.c
+++ b/bin/varnishd/cache/cache_wrw.c
@@ -57,6 +57,7 @@ struct wrw {
 	ssize_t			cliov;
 	unsigned		ciov;	/* Chunked header marker */
 	double			t0;
+	struct vsl_log		*vsl;
 };
 
 /*--------------------------------------------------------------------
@@ -70,7 +71,7 @@ WRW_Error(const struct worker *wrk)
 }
 
 void
-WRW_Reserve(struct worker *wrk, int *fd, double t0)
+WRW_Reserve(struct worker *wrk, int *fd, struct vsl_log *vsl, double t0)
 {
 	struct wrw *wrw;
 	unsigned u;
@@ -95,6 +96,7 @@ WRW_Reserve(struct worker *wrk, int *fd, double t0)
 	wrw->niov = 0;
 	wrw->wfd = fd;
 	wrw->t0 = t0;
+	wrw->vsl = vsl;
 	wrk->wrw = wrw;
 }
 
@@ -136,7 +138,7 @@ wrw_prune(struct wrw *wrw, ssize_t bytes)
 }
 
 unsigned
-WRW_Flush(struct worker *wrk)
+WRW_Flush(const struct worker *wrk)
 {
 	ssize_t i;
 	struct wrw *wrw;
@@ -179,7 +181,7 @@ WRW_Flush(struct worker *wrk)
 			*/
 
 			if (VTIM_real() - wrw->t0 > cache_param->send_timeout) {
-				WSL(wrk->vsl, SLT_Debug, *wrw->wfd,
+				VSLb(wrw->vsl, SLT_Debug,
 				    "Hit total send timeout, "
 				    "wrote = %zd/%zd; not retrying",
 				    i, wrw->liov);
@@ -187,7 +189,7 @@ WRW_Flush(struct worker *wrk)
 				break;
 			}
 
-			WSL(wrk->vsl, SLT_Debug, *wrw->wfd,
+			VSLb(wrw->vsl, SLT_Debug,
 			    "Hit send timeout, wrote = %zd/%zd; retrying",
 			    i, wrw->liov);
 
@@ -196,7 +198,7 @@ WRW_Flush(struct worker *wrk)
 		}
 		if (i <= 0) {
 			wrw->werr++;
-			WSL(wrk->vsl, SLT_Debug, *wrw->wfd,
+			VSLb(wrw->vsl, SLT_Debug,
 			    "Write error, retval = %zd, len = %zd, errno = %s",
 			    i, wrw->liov, strerror(errno));
 		}
@@ -222,7 +224,7 @@ WRW_FlushRelease(struct worker *wrk)
 }
 
 unsigned
-WRW_WriteH(struct worker *wrk, const txt *hh, const char *suf)
+WRW_WriteH(const struct worker *wrk, const txt *hh, const char *suf)
 {
 	unsigned u;
 
@@ -239,7 +241,7 @@ WRW_WriteH(struct worker *wrk, const txt *hh, const char *suf)
 }
 
 unsigned
-WRW_Write(struct worker *wrk, const void *ptr, int len)
+WRW_Write(const struct worker *wrk, const void *ptr, int len)
 {
 	struct wrw *wrw;
 
@@ -265,7 +267,7 @@ WRW_Write(struct worker *wrk, const void *ptr, int len)
 }
 
 void
-WRW_Chunked(struct worker *wrk)
+WRW_Chunked(const struct worker *wrk)
 {
 	struct wrw *wrw;
 
@@ -294,7 +296,7 @@ WRW_Chunked(struct worker *wrk)
  */
 
 void
-WRW_EndChunk(struct worker *wrk)
+WRW_EndChunk(const struct worker *wrk)
 {
 	struct wrw *wrw;
 



More information about the varnish-commit mailing list