[experimental-ims] af2bfa9 Push struct worker further upwards

Geoff Simmons geoff at varnish-cache.org
Fri Feb 17 13:58:53 CET 2012


commit af2bfa9445d385c316f64263b0320eae7a1f9fde
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 15 09:37:57 2012 +0000

    Push struct worker further upwards

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 42788c3..62b1202 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -753,7 +753,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(struct worker *w, struct lru *lru);
+int EXP_NukeOne(struct vsl_log *, struct dstat *, struct lru *lru);
 
 /* cache_fetch.c */
 struct storage *FetchStorage(struct worker *w, ssize_t sz);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 0d8ffe1..9bdf25f 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -414,7 +414,7 @@ exp_timer(struct sess *sp, void *priv)
  */
 
 int
-EXP_NukeOne(struct worker *wrk, struct lru *lru)
+EXP_NukeOne(struct vsl_log *vsl, struct dstat *ds, struct lru *lru)
 {
 	struct objcore *oc;
 
@@ -445,8 +445,8 @@ EXP_NukeOne(struct worker *wrk, struct lru *lru)
 		return (-1);
 
 	/* XXX: bad idea for -spersistent */
-	WSL(wrk->vsl, SLT_ExpKill, 0, "%u LRU", oc_getxid(&wrk->stats, oc));
-	(void)HSH_Deref(&wrk->stats, oc, NULL);
+	WSL(vsl, SLT_ExpKill, -1, "%u LRU", oc_getxid(ds, oc));
+	(void)HSH_Deref(ds, oc, NULL);
 	return (1);
 }
 
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index ae71f6e..50db0db 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -127,7 +127,7 @@ LRU_Free(struct lru *lru)
  */
 
 static struct stevedore *
-stv_pick_stevedore(struct worker *wrk, const char **hint)
+stv_pick_stevedore(struct vsl_log *vsl, const char **hint)
 {
 	struct stevedore *stv;
 
@@ -141,8 +141,7 @@ stv_pick_stevedore(struct worker *wrk, const char **hint)
 			return (stv_transient);
 
 		/* Hint was not valid, nuke it */
-		WSL(wrk->vsl, SLT_Debug, 0,		/* XXX VSL_id ?? */
-		    "Storage hint not usable");
+		WSL(vsl, SLT_Debug, -1, "Storage hint not usable");
 		*hint = NULL;
 	}
 	/* pick a stevedore and bump the head along */
@@ -189,7 +188,7 @@ stv_alloc(struct worker *w, const struct object *obj, size_t size)
 		}
 
 		/* no luck; try to free some space and keep trying */
-		if (EXP_NukeOne(w, stv->lru) == -1)
+		if (EXP_NukeOne(w->vsl, &w->stats, stv->lru) == -1)
 			break;
 
 		/* Enough is enough: try another if we have one */
@@ -327,12 +326,12 @@ STV_NewObject(struct worker *wrk, const char *hint, unsigned wsl,
 
 	ltot = sizeof *o + wsl + lhttp;
 
-	stv = stv0 = stv_pick_stevedore(wrk, &hint);
+	stv = stv0 = stv_pick_stevedore(wrk->vsl, &hint);
 	AN(stv->allocobj);
 	o = stv->allocobj(stv, wrk, ltot, &soc);
 	if (o == NULL && hint == NULL) {
 		do {
-			stv = stv_pick_stevedore(wrk, &hint);
+			stv = stv_pick_stevedore(wrk->vsl, &hint);
 			AN(stv->allocobj);
 			o = stv->allocobj(stv, wrk, ltot, &soc);
 		} while (o == NULL && stv != stv0);
@@ -340,7 +339,7 @@ STV_NewObject(struct worker *wrk, const char *hint, unsigned wsl,
 	if (o == NULL) {
 		/* no luck; try to free some space and keep trying */
 		for (i = 0; o == NULL && i < cache_param->nuke_limit; i++) {
-			if (EXP_NukeOne(wrk, stv->lru) == -1)
+			if (EXP_NukeOne(wrk->vsl, &wrk->stats, stv->lru) == -1)
 				break;
 			o = stv->allocobj(stv, wrk, ltot, &soc);
 		}



More information about the varnish-commit mailing list