#define OC_T_PREFETCH 2
unsigned char flags;
#define OC_F_ONLRU (1<<0)
+#define OC_F_BUSY (1<<1)
unsigned timer_idx;
VTAILQ_ENTRY(objcore) list;
VTAILQ_ENTRY(objcore) lru_list;
unsigned cacheable;
- unsigned busy;
unsigned len;
double age;
/* Prototypes etc ----------------------------------------------------*/
-
/* cache_acceptor.c */
void vca_return_session(struct sess *sp);
void vca_close_session(struct sess *sp, const char *why);
t->b = t->e;
}
}
+
+static inline unsigned
+ObjIsBusy(const struct object *o)
+{
+ CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+ CHECK_OBJ_NOTNULL(o->objcore, OBJCORE_MAGIC);
+ return (o->objcore->flags & OC_F_BUSY);
+}
sp->obj = o;
/* If we inserted a new object it's a miss */
- if (sp->obj->busy) {
+ if (ObjIsBusy(sp->obj)) {
VSL_stats->cache_miss++;
sp->step = STP_MISS;
return (0);
HSH_Prealloc(sp);
sp->obj = sp->wrk->nobj;
sp->wrk->nobj = NULL;
- sp->obj->busy = 1;
sp->sendbody = 1;
sp->step = STP_FETCH;
return (0);
struct objcore *oc;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
- assert(o->busy);
+ AN(ObjIsBusy(o));
assert(o->cacheable);
HSH_Ref(o);
CHECK_OBJ_NOTNULL(o->objcore, OBJCORE_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC);
AN(sp->director);
- AN(sp->obj->busy);
+ if (sp->obj->objcore != NULL) /* pass has no objcore */
+ AN(ObjIsBusy(sp->obj));
AN(sp->bereq);
w = sp->wrk;
bereq = sp->bereq;
if (w->nobjcore == NULL) {
ALLOC_OBJ(oc, OBJCORE_MAGIC);
w->nobjcore = oc;
+ oc->flags |= OC_F_BUSY;
}
CHECK_OBJ_NOTNULL(w->nobjcore, OBJCORE_MAGIC);
http_Setup(o->http, o->ws_o);
o->magic = OBJECT_MAGIC;
o->http->magic = HTTP_MAGIC;
- o->busy = 1;
o->refcnt = 1;
o->grace = NAN;
o->entered = NAN;
o = oc->obj;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
- if (o->busy) {
+ if (ObjIsBusy(o)) {
busy_o = o;
continue;
}
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
o = sp->obj;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
- assert(o->busy);
+ AN(ObjIsBusy(o));
assert(o->refcnt > 0);
o->ttl = 0;
o->cacheable = 0;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
o = sp->obj;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
- assert(o->busy);
+ AN(ObjIsBusy(o));
assert(o->refcnt > 0);
if (o->ws_o->overflow)
VSL_stats->n_objoverflow++;
CHECK_OBJ(oh, OBJHEAD_MAGIC);
Lck_Lock(&oh->mtx);
}
- o->busy = 0;
+ o->objcore->flags &= ~OC_F_BUSY;
if (oh != NULL)
hsh_rush(oh);
parent = o->parent;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
-
- assert(sp->obj->busy);
+ AN(ObjIsBusy(sp->obj));
if (sp->cur_method != VCL_MET_FETCH) {
/* XXX: we should catch this at compile time */
WSP(sp, SLT_VCL_error,