[master] f7b57f5 Rename ObjSnipe() and ObjKill() to HSH_ditto since they don't actually call into the stevedores methods.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Feb 9 01:19:12 CET 2016
commit f7b57f54142dff6c4e899569e08e22f56d4123af
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Feb 8 23:22:57 2016 +0000
Rename ObjSnipe() and ObjKill() to HSH_ditto since they don't actually
call into the stevedores methods.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index a9cd4fd..3797f1d 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -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 *);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 74e1bfc..2e71c83 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -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);
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 7fbd283..0e88dab 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -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
*/
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index d0ae3db..1fa8d01 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -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)
*
@@ -428,52 +428,6 @@ ObjTouch(struct worker *wrk, struct objcore *oc, double 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
*/
diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h
index b4b7bcd..807c83d 100644
--- a/bin/varnishd/hash/hash_slinger.h
+++ b/bin/varnishd/hash/hash_slinger.h
@@ -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
diff --git a/bin/varnishd/storage/storage_lru.c b/bin/varnishd/storage/storage_lru.c
index 987a0f1..785e3e1 100644
--- a/bin/varnishd/storage/storage_lru.c
+++ b/bin/varnishd/storage/storage_lru.c
@@ -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);
More information about the varnish-commit
mailing list