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

Rename ObjSnipe() and ObjKill() to HSH_ditto since they don't actually

call into the stevedores methods.
parent f583b81f
......@@ -882,8 +882,6 @@ void ObjSetState(const struct objcore *, enum boc_state_e next);
void ObjWaitState(const struct objcore *, enum boc_state_e want);
void ObjTrimStore(struct worker *, struct objcore *);
void ObjTouch(struct worker *, struct objcore *, double now);
int ObjSnipe(const struct worker *, struct objcore *);
void ObjKill(struct objcore *);
unsigned ObjGetXID(struct worker *, struct objcore *);
uint64_t ObjGetLen(struct worker *, struct objcore *);
void ObjUpdateMeta(struct worker *, struct objcore *);
......
......@@ -311,7 +311,7 @@ exp_expire(struct exp_priv *ep, double now)
VSC_C_main->n_expired++;
if (!(oc->flags & OC_F_DYING))
ObjKill(oc);
HSH_Kill(oc);
/* Remove from binheap */
assert(oc->timer_idx != BINHEAP_NOIDX);
......
......@@ -671,6 +671,53 @@ HSH_Unbusy(struct worker *wrk, struct objcore *oc)
Lck_Unlock(&oh->mtx);
}
/*====================================================================
* HSH_Kill()
*
* It's dead Jim, kick it...
*/
void
HSH_Kill(struct objcore *oc)
{
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
Lck_Lock(&oc->objhead->mtx);
oc->flags |= OC_F_DYING;
Lck_Unlock(&oc->objhead->mtx);
}
/*====================================================================
* HSH_Snipe()
*
* If objcore is idle, gain a ref and mark it dead.
*/
int
HSH_Snipe(const struct worker *wrk, struct objcore *oc)
{
int retval = 0;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
AZ(oc->flags & OC_F_DYING);
if (oc->refcnt == 1 && !Lck_Trylock(&oc->objhead->mtx)) {
if (oc->refcnt == 1) {
oc->flags |= OC_F_DYING;
oc->refcnt++;
retval = 1;
}
Lck_Unlock(&oc->objhead->mtx);
}
return (retval);
}
/*---------------------------------------------------------------------
* Gain a reference on an objcore
*/
......
......@@ -71,8 +71,8 @@
*
* 23 ObjUpdateMeta() ban/ttl/grace/keep changed
*
* 3->4 ObjSnipe() kill if not in use
* 3->4 ObjKill() make unavailable
* 3->4 HSH_Snipe() kill if not in use
* 3->4 HSH_Kill() make unavailable
*
* 234 ObjSlim() Release body storage (but retain attribute storage)
*
......@@ -427,52 +427,6 @@ ObjTouch(struct worker *wrk, struct objcore *oc, double now)
om->objtouch(wrk, oc, now);
}
/*====================================================================
* ObjKill()
*
* It's dead Jim, kick it...
*/
void
ObjKill(struct objcore *oc)
{
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
Lck_Lock(&oc->objhead->mtx);
oc->flags |= OC_F_DYING;
Lck_Unlock(&oc->objhead->mtx);
}
/*====================================================================
* ObjSnipe()
*
* If objcore is idle, gain a ref and mark it dead.
*/
int
ObjSnipe(const struct worker *wrk, struct objcore *oc)
{
int retval = 0;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
AZ(oc->flags & OC_F_DYING);
if (oc->refcnt == 1 && !Lck_Trylock(&oc->objhead->mtx)) {
if (oc->refcnt == 1) {
oc->flags |= OC_F_DYING;
oc->refcnt++;
retval = 1;
}
Lck_Unlock(&oc->objhead->mtx);
}
return (retval);
}
/*====================================================================
* Utility functions which work on top of the previous ones
*/
......
......@@ -75,6 +75,8 @@ struct boc *HSH_RefBoc(const struct objcore *);
void HSH_DerefBoc(struct worker *wrk, struct objcore *);
struct objcore *HSH_Private(struct worker *wrk);
void HSH_Abandon(struct objcore *oc);
int HSH_Snipe(const struct worker *, struct objcore *);
void HSH_Kill(struct objcore *);
#ifdef VARNISH_CACHE_CHILD
......
......@@ -175,7 +175,7 @@ LRU_NukeOne(struct worker *wrk, struct lru *lru)
VSLb(wrk->vsl, SLT_ExpKill, "LRU_Cand p=%p f=0x%x r=%d",
oc, oc->flags, oc->refcnt);
if (ObjSnipe(wrk, oc)) {
if (HSH_Snipe(wrk, oc)) {
VSC_C_main->n_lru_nuked++; // XXX per lru ?
VTAILQ_REMOVE(&lru->lru_head, oc, lru_list);
VTAILQ_INSERT_TAIL(&lru->lru_head, oc, lru_list);
......
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