[master] d30d554 Isolate the EXP_ interactions in cache_hash.c and mark the functions private.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Apr 19 18:15:06 CEST 2016
commit d30d554ca2779026305a16918bcea1242c87b414
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Apr 19 09:00:20 2016 +0000
Isolate the EXP_ interactions in cache_hash.c and mark the functions
private.
Rename EXP_Poke() to EXP_Remove()
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 77f62e1..52fcef9 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -712,12 +712,6 @@ extern pthread_t cli_thread;
#define EXP_WHEN(to) \
((to)->t_origin + (to)->ttl + (to)->grace + (to)->keep)
-double EXP_Ttl(const struct req *, const struct objcore *);
-void EXP_Insert(struct worker *wrk, struct objcore *oc);
-void EXP_Rearm(struct objcore *, double now, double ttl, double grace,
- double keep);
-void EXP_Poke(struct objcore *);
-
/* cache_fetch.c */
enum vbf_fetch_mode_e {
VBF_NORMAL = 0,
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 9d474ba..b0524cc 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -104,7 +104,7 @@ exp_mail_it(struct objcore *oc, uint8_t cmds)
*/
void
-EXP_Poke(struct objcore *oc)
+EXP_Remove(struct objcore *oc)
{
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 1fb627c..6df5160 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -411,7 +411,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
if (BAN_CheckObject(wrk, oc, req)) {
oc->flags |= OC_F_DYING;
- EXP_Poke(oc);
+ EXP_Remove(oc);
continue;
}
@@ -706,7 +706,7 @@ HSH_Kill(struct objcore *oc)
Lck_Lock(&oc->objhead->mtx);
oc->flags |= OC_F_DYING;
Lck_Unlock(&oc->objhead->mtx);
- EXP_Poke(oc);
+ EXP_Remove(oc);
}
/*====================================================================
@@ -734,6 +734,8 @@ HSH_Snipe(const struct worker *wrk, struct objcore *oc)
}
Lck_Unlock(&oc->objhead->mtx);
}
+ if (retval)
+ EXP_Remove(oc);
return (retval);
}
diff --git a/bin/varnishd/cache/cache_priv.h b/bin/varnishd/cache/cache_priv.h
index ff354a6..315cf96 100644
--- a/bin/varnishd/cache/cache_priv.h
+++ b/bin/varnishd/cache/cache_priv.h
@@ -42,7 +42,12 @@ void VBE_Poll(void);
/* cache_backend_poll.c */
void VBP_Init(void);
-/* == cache_ban.c == */
+/* cache_exp.c */
+double EXP_Ttl(const struct req *, const struct objcore *);
+void EXP_Insert(struct worker *wrk, struct objcore *oc);
+void EXP_Rearm(struct objcore *, double now, double ttl, double grace,
+ double keep);
+void EXP_Remove(struct objcore *);
/* From cache_main.c */
void BAN_Init(void);
diff --git a/bin/varnishd/storage/storage_lru.c b/bin/varnishd/storage/storage_lru.c
index 9ca5380..fddd4a0 100644
--- a/bin/varnishd/storage/storage_lru.c
+++ b/bin/varnishd/storage/storage_lru.c
@@ -189,8 +189,6 @@ LRU_NukeOne(struct worker *wrk, struct lru *lru)
/* XXX: We could grab and return one storage segment to our caller */
ObjSlim(wrk, oc);
- EXP_Poke(oc);
-
VSLb(wrk->vsl, SLT_ExpKill, "LRU x=%u", ObjGetXID(wrk, oc));
(void)HSH_DerefObjCore(wrk, &oc); // Ref from ObjSnipe
return (1);
More information about the varnish-commit
mailing list