[master] a583d0c Move the lru timestamp to objcore. Not sure how we managed to forget that in obj.

Poul-Henning Kamp phk at varnish-cache.org
Thu Sep 5 10:51:07 CEST 2013


commit a583d0c69387d78da394635c63457bf8029589c6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Sep 5 08:50:26 2013 +0000

    Move the lru timestamp to objcore.  Not sure how we managed to forget
    that in obj.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index c104506..7c9b1e0 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -428,6 +428,7 @@ struct objcore {
 	unsigned		timer_idx;
 	VTAILQ_ENTRY(objcore)	list;
 	VTAILQ_ENTRY(objcore)	lru_list;
+	double			last_lru;
 	VTAILQ_ENTRY(objcore)	ban_list;
 	struct ban		*ban;
 };
@@ -595,7 +596,6 @@ struct object {
 	struct exp		exp;
 
 	double			last_modified;
-	double			last_lru;
 
 	struct http		*http;
 
@@ -836,7 +836,7 @@ void EXP_Set_keep(struct exp *e, double v);
 
 double EXP_Ttl(const struct req *, const struct object*);
 double EXP_Grace(const struct req *, const struct object*);
-void EXP_Insert(struct object *o);
+void EXP_Insert(const struct object *o);
 void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
 void EXP_Init(void);
 void EXP_Rearm(const struct object *o);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 090a209..d764856 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -216,7 +216,7 @@ EXP_Inject(struct objcore *oc, struct lru *lru, double when)
  */
 
 void
-EXP_Insert(struct object *o)
+EXP_Insert(const struct object *o)
 {
 	struct objcore *oc;
 	struct lru *lru;
@@ -227,7 +227,7 @@ EXP_Insert(struct object *o)
 	HSH_Ref(oc);
 
 	assert(o->exp.entered != 0 && !isnan(o->exp.entered));
-	o->last_lru = o->exp.entered;
+	oc->last_lru = o->exp.entered;
 
 	lru = oc_getlru(oc);
 	CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 9ed176e..4a10c14 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -171,10 +171,9 @@ cnt_deliver(struct worker *wrk, struct req *req)
 
 	req->t_resp = W_TIM_real(wrk);
 	if (!(req->obj->objcore->flags & OC_F_PRIVATE)) {
-		if ((req->t_resp - req->obj->last_lru) >
-		    cache_param->lru_timeout &&
-		    EXP_Touch(req->obj->objcore))
-			req->obj->last_lru = req->t_resp;
+		if ((req->t_resp - req->obj->objcore->last_lru) >
+		    cache_param->lru_timeout && EXP_Touch(req->obj->objcore))
+			req->obj->objcore->last_lru = req->t_resp;
 		if (!cache_param->obj_readonly)
 			req->obj->last_use = req->t_resp; /* XXX: locking ? */
 	}



More information about the varnish-commit mailing list