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

Reduce the amount of magic for persistent stevedores.

parent 3995e910
......@@ -682,7 +682,6 @@ void EXP_Clr(struct exp *e);
double EXP_Ttl(const struct req *, const struct exp*);
double EXP_When(const struct exp *exp);
void EXP_Insert(struct worker *wrk, struct objcore *oc);
void EXP_Inject(struct worker *wrk, struct objcore *oc);
void EXP_Rearm(struct objcore *, double now, double ttl, double grace,
double keep);
void EXP_Poke(struct objcore *);
......
......@@ -166,30 +166,6 @@ EXP_Poke(struct objcore *oc)
exp_mail_it(oc, 0);
}
/*--------------------------------------------------------------------
* Inject an object with a reference into the binheap.
*
* This can either come from a stevedore (persistent) during startup
* or from EXP_Insert() below.
*/
void
EXP_Inject(struct worker *wrk, struct objcore *oc)
{
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
AZ(oc->exp_flags & (OC_EF_INSERT | OC_EF_MOVE));
AZ(oc->flags & OC_F_DYING);
AZ(oc->flags & OC_F_BUSY);
oc->timer_when = EXP_When(&oc->exp);
exp_event(wrk, oc, EXP_INJECT);
exp_mail_it(oc, OC_EF_INSERT | OC_EF_EXP);
}
/*--------------------------------------------------------------------
* Insert new object.
*
......@@ -203,11 +179,11 @@ EXP_Insert(struct worker *wrk, struct objcore *oc)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
HSH_Ref(oc);
AZ(oc->exp_flags & (OC_EF_INSERT | OC_EF_MOVE));
AZ(oc->flags & OC_F_DYING);
AN(oc->flags & OC_F_BUSY);
HSH_Ref(oc);
exp_event(wrk, oc, EXP_INSERT);
exp_mail_it(oc, OC_EF_INSERT | OC_EF_EXP | OC_EF_MOVE);
......@@ -352,7 +328,7 @@ exp_expire(struct exp_priv *ep, double now)
if (oc == NULL)
return (now + 355./113.);
VSLb(&ep->vsl, SLT_ExpKill, "EXP_expire p=%p e=%.9f f=0x%x", oc,
oc->timer_when, oc->flags);
oc->timer_when - now, oc->flags);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
......
......@@ -273,7 +273,6 @@ HSH_Insert(struct worker *wrk, const void *digest, struct objcore *oc)
assert(oh->refcnt > 0);
/* Insert (precreated) objcore in objecthead */
oc->refcnt = 1;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
AZ(oc->flags & OC_F_BUSY);
......@@ -745,6 +744,7 @@ HSH_DerefBoc(struct worker *wrk, struct objcore *oc)
boc = oc->boc;
CHECK_OBJ_NOTNULL(boc, BOC_MAGIC);
Lck_Lock(&oc->objhead->mtx);
assert(oc->refcnt > 0);
assert(boc->refcount > 0);
r = --boc->refcount;
if (r == 0)
......
......@@ -165,13 +165,15 @@ smp_load_seg(struct worker *wrk, const struct smp_sc *sc,
smp_init_oc(oc, sg, no);
oc->stobj->priv2 |= NEED_FIXUP;
oc->ban = BAN_RefBan(oc, so->ban);
HSH_Insert(wrk, so->hash, oc);
oc->exp = so->exp;
sg->nobj++;
EXP_Inject(wrk, oc);
oc->refcnt++;
HSH_Insert(wrk, so->hash, oc);
EXP_Insert(wrk, oc);
AN(isnan(oc->last_lru));
HSH_DerefBoc(wrk, oc); // XXX Keep it an stream resurrection?
AZ(isnan(oc->last_lru));
(void)HSH_DerefObjCore(wrk, &oc);
}
Pool_Sumstat(wrk);
sg->flags |= SMP_SEG_LOADED;
......@@ -457,17 +459,14 @@ smp_oc_sml_getobj(struct worker *wrk, struct objcore *oc)
return (o);
}
static void
static void __match_proto__(objupdatemeta_f)
smp_oc_objupdatemeta(struct worker *wrk, struct objcore *oc)
{
struct object *o;
struct smp_seg *sg;
struct smp_object *so;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
o = smp_oc_sml_getobj(wrk, oc);
AN(o);
CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC);
CHECK_OBJ_NOTNULL(sg->sc, SMP_SC_MAGIC);
......
......@@ -52,6 +52,8 @@ varnish v1 -vcl+backend {
delay 5
varnish v1 -expect n_object == 0
logexpect l1 -v v1 -g vxid -q "Begin ~ bereq" {
expect * 1002 Storage "persistent s0"
} -start
......
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