[master] 30046dc Make EXP_NukeOne() make do with a struct worker arg instead of sess.

Poul-Henning Kamp phk at varnish-cache.org
Fri Oct 21 14:19:41 CEST 2011


commit 30046dce5fda7281b67169a1ad24484c0765c391
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Oct 21 12:19:16 2011 +0000

    Make EXP_NukeOne() make do with a struct worker arg instead of sess.

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 22e61ae..e94180a 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -697,7 +697,7 @@ void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
 void EXP_Init(void);
 void EXP_Rearm(const struct object *o);
 int EXP_Touch(struct objcore *oc);
-int EXP_NukeOne(const struct sess *sp, struct lru *lru);
+int EXP_NukeOne(struct worker *w, struct lru *lru);
 
 /* cache_fetch.c */
 struct storage *FetchStorage(const struct sess *sp, ssize_t sz);
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 6bf0b0c..fd3238d 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -440,8 +440,8 @@ cnt_error(struct sess *sp)
 		     &w->exp, (uint16_t)params->http_max_hdr);
 		if (sp->obj == NULL)
 			sp->obj = STV_NewObject(sp, TRANSIENT_STORAGE,
-			     params->http_resp_size , &w->exp,
-			     (uint16_t)params->http_max_hdr);
+			    params->http_resp_size, &w->exp,
+			    (uint16_t)params->http_max_hdr);
 		if (sp->obj == NULL) {
 			sp->doclose = "Out of objects";
 			sp->director = NULL;
diff --git a/bin/varnishd/cache_expire.c b/bin/varnishd/cache_expire.c
index 601025c..f7f779d 100644
--- a/bin/varnishd/cache_expire.c
+++ b/bin/varnishd/cache_expire.c
@@ -414,7 +414,7 @@ exp_timer(struct sess *sp, void *priv)
  */
 
 int
-EXP_NukeOne(const struct sess *sp, struct lru *lru)
+EXP_NukeOne(struct worker *w, struct lru *lru)
 {
 	struct objcore *oc;
 	struct object *o;
@@ -446,9 +446,9 @@ EXP_NukeOne(const struct sess *sp, struct lru *lru)
 		return (-1);
 
 	/* XXX: bad idea for -spersistent */
-	o = oc_getobj(sp->wrk, oc);
-	WSL(sp->wrk, SLT_ExpKill, 0, "%u LRU", o->xid);
-	(void)HSH_Deref(sp->wrk, NULL, &o);
+	o = oc_getobj(w, oc);
+	WSL(w, SLT_ExpKill, 0, "%u LRU", o->xid);
+	(void)HSH_Deref(w, NULL, &o);
 	return (1);
 }
 
diff --git a/bin/varnishd/cache_http.c b/bin/varnishd/cache_http.c
index aaa8212..784eb28 100644
--- a/bin/varnishd/cache_http.c
+++ b/bin/varnishd/cache_http.c
@@ -1001,7 +1001,6 @@ http_PutResponse(struct worker *w, unsigned vsl_id, const struct http *to,
 	if (to->hd[HTTP_HDR_RESPONSE].b == NULL)
 		http_SetH(to, HTTP_HDR_RESPONSE, "Lost Response");
 	Tcheck(to->hd[HTTP_HDR_RESPONSE]);
-
 }
 
 void
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 65f9f49..bd42e54 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -184,7 +184,7 @@ stv_alloc(const struct sess *sp, size_t size)
 		}
 
 		/* no luck; try to free some space and keep trying */
-		if (EXP_NukeOne(sp, stv->lru) == -1)
+		if (EXP_NukeOne(sp->wrk, stv->lru) == -1)
 			break;
 
 		/* Enough is enough: try another if we have one */
@@ -336,7 +336,7 @@ STV_NewObject(struct sess *sp, const char *hint, unsigned wsl, struct exp *ep,
 	if (o == NULL) {
 		/* no luck; try to free some space and keep trying */
 		for (i = 0; o == NULL && i < params->nuke_limit; i++) {
-			if (EXP_NukeOne(sp, stv->lru) == -1)
+			if (EXP_NukeOne(sp->wrk, stv->lru) == -1)
 				break;
 			o = stv->allocobj(stv, sp, ltot, &soc);
 		}



More information about the varnish-commit mailing list