r3773 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Mon Feb 16 16:06:18 CET 2009
Author: phk
Date: 2009-02-16 16:06:18 +0100 (Mon, 16 Feb 2009)
New Revision: 3773
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/cache_fetch.c
trunk/varnish-cache/bin/varnishd/cache_hash.c
trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
Log:
Move the object busy flag up to the objcore.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2009-02-16 14:22:00 UTC (rev 3772)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2009-02-16 15:06:18 UTC (rev 3773)
@@ -267,6 +267,7 @@
#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;
@@ -294,7 +295,6 @@
unsigned cacheable;
- unsigned busy;
unsigned len;
double age;
@@ -416,7 +416,6 @@
/* Prototypes etc ----------------------------------------------------*/
-
/* cache_acceptor.c */
void vca_return_session(struct sess *sp);
void vca_close_session(struct sess *sp, const char *why);
@@ -698,3 +697,11 @@
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);
+}
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2009-02-16 14:22:00 UTC (rev 3772)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2009-02-16 15:06:18 UTC (rev 3773)
@@ -601,7 +601,7 @@
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);
@@ -730,7 +730,6 @@
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);
Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2009-02-16 14:22:00 UTC (rev 3772)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2009-02-16 15:06:18 UTC (rev 3773)
@@ -128,7 +128,7 @@
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);
Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2009-02-16 14:22:00 UTC (rev 3772)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2009-02-16 15:06:18 UTC (rev 3773)
@@ -326,7 +326,8 @@
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;
Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2009-02-16 14:22:00 UTC (rev 3772)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2009-02-16 15:06:18 UTC (rev 3773)
@@ -96,6 +96,7 @@
if (w->nobjcore == NULL) {
ALLOC_OBJ(oc, OBJCORE_MAGIC);
w->nobjcore = oc;
+ oc->flags |= OC_F_BUSY;
}
CHECK_OBJ_NOTNULL(w->nobjcore, OBJCORE_MAGIC);
@@ -126,7 +127,6 @@
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;
@@ -269,7 +269,7 @@
o = oc->obj;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
- if (o->busy) {
+ if (ObjIsBusy(o)) {
busy_o = o;
continue;
}
@@ -377,7 +377,7 @@
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;
@@ -395,7 +395,7 @@
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++;
@@ -408,7 +408,7 @@
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;
Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2009-02-16 14:22:00 UTC (rev 3772)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2009-02-16 15:06:18 UTC (rev 3773)
@@ -643,8 +643,7 @@
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,
More information about the varnish-commit
mailing list