Commit bd0246a0 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Edge closer to the new worldorder

parent 20d561d9
......@@ -1081,21 +1081,6 @@ Tadd(txt *t, const char *p, int l)
}
}
static inline void
AssertOCBusy(const struct objcore *oc)
{
AN(oc);
AN (oc->flags & OC_F_BUSY);
AN(oc->busyobj);
}
static inline void
AssertObjCorePassOrBusy(const struct objcore *oc)
{
if (oc != NULL)
AN (oc->flags & OC_F_BUSY);
}
/*
* We want to cache the most recent timestamp in wrk->lastused to avoid
* extra timestamps in cache_pool.c. Hide this detail with a macro
......
......@@ -215,7 +215,6 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
if (bo != NULL) {
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
AN(bo->do_stream);
AssertObjCorePassOrBusy(req->obj->objcore);
}
req->res_mode = 0;
......@@ -635,7 +634,6 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
switch (req->handling) {
case VCL_RET_DELIVER:
AssertObjCorePassOrBusy(req->objcore);
sp->step = STP_PREPFETCH;
return (0);
default:
......@@ -875,8 +873,6 @@ cnt_prepfetch(struct sess *sp, struct worker *wrk, struct req *req)
RFC2616_Do_Cond(sp))
bo->do_stream = 0;
AssertObjCorePassOrBusy(req->obj->objcore);
sp->step = STP_FETCHBODY;
return (0);
}
......@@ -1136,6 +1132,9 @@ cnt_lookup(struct sess *sp, struct worker *wrk, struct req *req)
return (0);
}
/* We are not prepared to do streaming yet */
XXXAZ(req->busyobj);
o = oc_getobj(&wrk->stats, oc);
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
req->obj = o;
......
......@@ -224,7 +224,6 @@ EXP_Insert(struct object *o)
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
oc = o->objcore;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
AssertOCBusy(oc);
HSH_Ref(oc);
assert(o->exp.entered != 0 && !isnan(o->exp.entered));
......
......@@ -40,6 +40,7 @@
#include "cache_backend.h"
#include "vcli_priv.h"
#include "vct.h"
#include "vmb.h"
#include "vtcp.h"
static unsigned fetchfrag;
......@@ -570,8 +571,6 @@ FetchBody(struct worker *wrk, void *priv)
if (bo->vfp == NULL)
bo->vfp = &vfp_nop;
AssertObjCorePassOrBusy(obj->objcore);
AZ(bo->vgz_rx);
AZ(VTAILQ_FIRST(&obj->store));
......@@ -681,6 +680,8 @@ FetchBody(struct worker *wrk, void *priv)
AN(obj->objcore->ban);
AZ(obj->ws_o->overflow);
HSH_Unbusy(&wrk->stats, obj->objcore);
obj->objcore->busyobj = NULL;
VMB();
}
/* XXX: Atomic assignment, needs volatile/membar ? */
......
......@@ -551,9 +551,7 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace)
/*---------------------------------------------------------------------
* Kill a busy object we don't need anyway.
* There may be sessions on the waiting list, so we cannot just blow
* it out of the water.
* Kill a busy object we don't need and can't use.
*/
void
......@@ -563,13 +561,14 @@ HSH_Drop(struct worker *wrk, struct object **oo)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AN(oo);
CHECK_OBJ_NOTNULL(*oo, OBJECT_MAGIC);
AssertObjCorePassOrBusy((*oo)->objcore);
(*oo)->exp.ttl = -1.;
if ((*oo)->objcore != NULL) /* Pass has no objcore */
HSH_Unbusy(&wrk->stats, (*oo)->objcore);
(void)HSH_Deref(&wrk->stats, NULL, oo);
AZ(HSH_Deref(&wrk->stats, NULL, oo));
}
/*---------------------------------------------------------------------
* Unbusy an objcore when the object is completely fetched.
*/
void
HSH_Unbusy(struct dstat *ds, struct objcore *oc)
{
......@@ -579,9 +578,8 @@ HSH_Unbusy(struct dstat *ds, struct objcore *oc)
oh = oc->objhead;
CHECK_OBJ(oh, OBJHEAD_MAGIC);
AssertOCBusy(oc);
AN(oc->flags & OC_F_BUSY);
AN(oc->ban);
assert(oc->refcnt > 0);
assert(oh->refcnt > 0);
/* XXX: pretouch neighbors on oh->objcs to prevent page-on under mtx */
......@@ -591,13 +589,15 @@ HSH_Unbusy(struct dstat *ds, struct objcore *oc)
VTAILQ_REMOVE(&oh->objcs, oc, list);
VTAILQ_INSERT_HEAD(&oh->objcs, oc, list);
oc->flags &= ~OC_F_BUSY;
oc->busyobj = NULL;
if (oh->waitinglist != NULL)
hsh_rush(ds, oh);
AN(oc->ban);
Lck_Unlock(&oh->mtx);
}
/*---------------------------------------------------------------------
* Gain a reference on an objcore
*/
void
HSH_Ref(struct objcore *oc)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment