#define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0)
/* cache_expiry.c */
-void EXP_Insert(struct object *o);
+void EXP_Insert(struct object *o, double now);
void EXP_Init(void);
void EXP_Rearm(struct object *o);
void EXP_Touch(struct object *o, double now);
sp->obj->cacheable = 1;
if (sp->obj->objhead != NULL) {
VRY_Create(sp);
- HSH_Ref(sp->obj); /* get another, STP_DELIVER will deref */
+ EXP_Insert(sp->obj, sp->wrk->used);
HSH_Unbusy(sp->obj);
}
sp->wrk->acct.fetch++;
/*--------------------------------------------------------------------*/
void
-EXP_Insert(struct object *o)
+EXP_Insert(struct object *o, double now)
{
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+ assert(o->busy);
+ assert(o->cacheable);
+ HSH_Ref(o);
assert(o->timer_idx == 0);
update_object_when(o);
+ o->lru_stamp = now;
LOCK(&exp_mtx);
binheap_insert(exp_heap, o);
VTAILQ_INSERT_TAIL(&exp_lru, o, deathrow);
}
UNLOCK(&oh->mtx);
BAN_NewObj(o);
- /*
- * It's cheaper to copy the timestamp here, than to get a new one
- * in EXP_Insert().
- */
- o->lru_stamp = w->used;
return (o);
}
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
assert(o->busy);
assert(o->refcnt > 0);
- if (o->cacheable)
- EXP_Insert(o);
oh = o->objhead;
if (oh != NULL) {
CHECK_OBJ(oh, OBJHEAD_MAGIC);