[master] f724b36 Lend the worker a pointer to req/bo's vsl to allow us to simplify some function arguments.

Poul-Henning Kamp phk at FreeBSD.org
Tue Sep 16 09:59:34 CEST 2014


commit f724b3638243d0b4b41c7d464f6558950acb22fa
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Sep 16 07:59:01 2014 +0000

    Lend the worker a pointer to req/bo's vsl to allow us to simplify some
    function arguments.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index b16edbb..d68e05f 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -349,6 +349,7 @@ struct worker {
 	struct busyobj		*nbo;
 	void			*nhashpriv;
 	struct dstat		stats[1];
+	struct vsl_log		*vsl;		// borrowed from req/bo
 
 	struct pool_task	task;
 
@@ -468,6 +469,7 @@ struct busyobj {
 	unsigned		refcount;
 	int			retries;
 	struct req		*req;
+	struct worker		*wrk;
 
 	uint8_t			*vary;
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index e8dc047..99654ae 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -858,6 +858,8 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 	VSLb_ts_busyobj(bo, "Start", W_TIM_real(wrk));
 
 	bo->stats = wrk->stats;
+	bo->wrk = wrk;
+	wrk->vsl = bo->vsl;
 
 	while (stp != F_STP_DONE) {
 		CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
@@ -899,6 +901,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 
 	bo->stats = NULL;
 
+	wrk->vsl = NULL;
 	VBO_DerefBusyObj(wrk, &bo);
 	THR_SetBusyobj(NULL);
 }
diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index fc41856..77524b3 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -363,6 +363,7 @@ Pool_Work_Thread(void *priv, struct worker *wrk)
 		CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 
 		WS_Reset(wrk->aws, NULL);
+		AZ(wrk->vsl);
 
 		tp = VTAILQ_FIRST(&pp->front_queue);
 		if (tp != NULL) {
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 457b97e..f0c418d 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -880,6 +880,7 @@ CNT_Request(struct worker *wrk, struct req *req)
 	AN(req->vsl->wid & VSL_CLIENTMARKER);
 
 	req->wrk = wrk;
+	wrk->vsl = req->vsl;
 
 	for (nxt = REQ_FSM_MORE; nxt == REQ_FSM_MORE; ) {
 		/*
@@ -913,6 +914,7 @@ CNT_Request(struct worker *wrk, struct req *req)
 		WS_Assert(wrk->aws);
 		CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC);
 	}
+	wrk->vsl = NULL;
 	if (nxt == REQ_FSM_DONE) {
 		AN(req->vsl->wid);
 		if (req->res_mode & (RES_ESI|RES_ESI_CHILD))



More information about the varnish-commit mailing list