Commit af2bfa94 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Push struct worker further upwards

parent f012e53d
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment