r5581 - trunk/varnish-cache/bin/varnishd
phk at varnish-cache.org
phk at varnish-cache.org
Mon Nov 22 10:34:50 CET 2010
Author: phk
Date: 2010-11-22 10:34:49 +0100 (Mon, 22 Nov 2010)
New Revision: 5581
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishd/cache_expire.c
trunk/varnish-cache/bin/varnishd/stevedore.c
trunk/varnish-cache/bin/varnishd/storage_persistent.c
Log:
Make EXP_Touch() responsible for updating the o->last_lru timestamp.
Various minor nits
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2010-11-22 09:08:52 UTC (rev 5580)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2010-11-22 09:34:49 UTC (rev 5581)
@@ -571,7 +571,7 @@
void EXP_Inject(struct objcore *oc, struct lru *lru, double ttl);
void EXP_Init(void);
void EXP_Rearm(const struct object *o);
-int EXP_Touch(const struct object *o);
+void EXP_Touch(struct object *o, double tnow);
int EXP_NukeOne(const struct sess *sp, const struct lru *lru);
/* cache_fetch.c */
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2010-11-22 09:08:52 UTC (rev 5580)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2010-11-22 09:34:49 UTC (rev 5581)
@@ -179,9 +179,8 @@
sp->t_resp = TIM_real();
if (sp->obj->objcore != NULL) {
- if ((sp->t_resp - sp->obj->last_lru) > params->lru_timeout &&
- EXP_Touch(sp->obj))
- sp->obj->last_lru = sp->t_resp; /* XXX: locking ? */
+ if ((sp->t_resp - sp->obj->last_lru) > params->lru_timeout)
+ EXP_Touch(sp->obj, sp->t_resp);
sp->obj->last_use = sp->t_resp; /* XXX: locking ? */
}
sp->wrk->resp = sp->wrk->http[2];
Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2010-11-22 09:08:52 UTC (rev 5580)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2010-11-22 09:34:49 UTC (rev 5581)
@@ -154,17 +154,14 @@
* This optimization obviously leaves the LRU list imperfectly sorted.
*/
-int
-EXP_Touch(const struct object *o)
+void
+EXP_Touch(struct object *o, double tnow)
{
- int retval;
struct objcore *oc;
struct lru *lru;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
oc = o->objcore;
- if (oc == NULL)
- return (0);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
/*
@@ -175,21 +172,22 @@
* the cleaner from doing its job.
*/
if (oc->flags & OC_F_LRUDONTMOVE)
- return (0);
+ return;
lru = STV_lru(o->objstore);
CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
- retval = 0;
+
if (Lck_Trylock(&exp_mtx))
- return (retval);
+ return;
+
if (oc->flags & OC_F_ONLRU) { /* XXX ?? */
VLIST_REMOVE(oc, lru_list);
VLIST_INSERT_BEFORE(&lru->senteniel, oc, lru_list);
VSC_main->n_lru_moved++;
- retval = 1;
+ o->last_lru = tnow;
}
+
Lck_Unlock(&exp_mtx);
- return (retval);
}
/*--------------------------------------------------------------------
Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c 2010-11-22 09:08:52 UTC (rev 5580)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c 2010-11-22 09:34:49 UTC (rev 5581)
@@ -305,6 +305,7 @@
CAST_OBJ_NOTNULL(o, oc->priv, OBJECT_MAGIC);
oc->priv = NULL;
+ oc->methods = NULL;
STV_Freestore(o);
STV_free(o->objstore);
Modified: trunk/varnish-cache/bin/varnishd/storage_persistent.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_persistent.c 2010-11-22 09:08:52 UTC (rev 5580)
+++ trunk/varnish-cache/bin/varnishd/storage_persistent.c 2010-11-22 09:34:49 UTC (rev 5581)
@@ -29,6 +29,8 @@
*
* XXX: Before we start the client or maybe after it stops, we should give the
* XXX: stevedores a chance to examine their storage for consistency.
+ *
+ * XXX: Do we ever free the LRU-lists ?
*/
#include "config.h"
More information about the varnish-commit
mailing list