[master] 6e6cc0b Rename OEV_REMOVE to OEV_EXPIRE to precisely capture its meaning.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Apr 19 18:15:06 CEST 2016
commit 6e6cc0bdb8bcc4c5a381f40dc7ca1bd35324d72a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Apr 19 09:06:08 2016 +0000
Rename OEV_REMOVE to OEV_EXPIRE to precisely capture its meaning.
The fact that the oc expired does not mean that the OC is going away
any time soon: It may be delivering War&Peace to a mobile phone in
outher Elbonia for quite some time still.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 52fcef9..eecb05b 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -889,12 +889,12 @@ int ObjGetU64(struct worker *, struct objcore *, enum obj_attr, uint64_t *);
int ObjCheckFlag(struct worker *, struct objcore *, enum obj_flags of);
void ObjSetFlag(struct worker *, struct objcore *, enum obj_flags of, int val);
-#define OEV_BANCHG (1U<<1)
-#define OEV_TTLCHG (1U<<2)
-#define OEV_INSERT (1U<<3)
-#define OEV_REMOVE (1U<<4)
+#define OEV_INSERT (1U<<1)
+#define OEV_BANCHG (1U<<2)
+#define OEV_TTLCHG (1U<<3)
+#define OEV_EXPIRE (1U<<4)
-#define OEV_MASK (OEV_BANCHG|OEV_TTLCHG|OEV_INSERT|OEV_REMOVE)
+#define OEV_MASK (OEV_INSERT|OEV_BANCHG|OEV_TTLCHG|OEV_EXPIRE)
typedef void obj_event_f(struct worker *, void *priv, struct objcore *,
unsigned);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index b0524cc..39c4626 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -115,8 +115,7 @@ EXP_Remove(struct objcore *oc)
/*--------------------------------------------------------------------
* Insert new object.
*
- * We grab a reference to the object, which will keep it around until
- * we decide its time to let it go.
+ * Caller got a oc->refcnt for us.
*/
void
@@ -186,10 +185,10 @@ exp_inbox(struct exp_priv *ep, struct objcore *oc, unsigned flags)
binheap_delete(ep->heap, oc->timer_idx);
}
assert(oc->timer_idx == BINHEAP_NOIDX);
- ObjSendEvent(ep->wrk, oc, OEV_REMOVE);
oc->exp_flags &= ~OC_EF_EXP;
assert(oc->refcnt > 0);
AZ(oc->exp_flags);
+ ObjSendEvent(ep->wrk, oc, OEV_EXPIRE);
(void)HSH_DerefObjCore(ep->wrk, &oc);
return;
}
@@ -258,7 +257,7 @@ exp_expire(struct exp_priv *ep, double now)
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
VSLb(&ep->vsl, SLT_ExpKill, "EXP_Expired x=%u t=%.0f",
ObjGetXID(ep->wrk, oc), EXP_Ttl(NULL, oc) - now);
- ObjSendEvent(ep->wrk, oc, OEV_REMOVE);
+ ObjSendEvent(ep->wrk, oc, OEV_EXPIRE);
(void)HSH_DerefObjCore(ep->wrk, &oc);
return (0);
}
diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index 9928991..ee3a005 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -212,7 +212,7 @@ obj_cb(struct worker *wrk, void *priv, struct objcore *oc, unsigned event)
CAST_OBJ_NOTNULL(priv_vcl, priv, PRIV_VCL_MAGIC);
switch (event) {
case OEV_INSERT: what = "insert"; break;
- case OEV_REMOVE: what = "remove"; break;
+ case OEV_EXPIRE: what = "expire"; break;
default: WRONG("Wrong object event");
}
@@ -230,7 +230,7 @@ vmod_register_obj_events(VRT_CTX, struct vmod_priv *priv)
CAST_OBJ_NOTNULL(priv_vcl, priv->priv, PRIV_VCL_MAGIC);
AZ(priv_vcl->obj_cb);
priv_vcl->obj_cb = ObjSubscribeEvents(obj_cb, priv_vcl,
- OEV_INSERT|OEV_REMOVE);
+ OEV_INSERT|OEV_EXPIRE);
VSL(SLT_Debug, 0, "Subscribed to Object Events");
}
More information about the varnish-commit
mailing list