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

Eliminate HSH_Complete(), the boc->state takes care of it.

parent 246428b5
......@@ -413,7 +413,6 @@ struct objcore {
uint8_t flags;
#define OC_F_BUSY (1<<1)
#define OC_F_PASS (1<<2)
#define OC_F_INCOMPLETE (1<<3)
#define OC_F_ABANDON (1<<4)
#define OC_F_PRIVATE (1<<5)
#define OC_F_FAILED (1<<6)
......
......@@ -946,7 +946,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
if (bo->fetch_objcore->boc->state == BOS_FINISHED) {
AZ(bo->fetch_objcore->flags & OC_F_FAILED);
HSH_Complete(bo->fetch_objcore);
VSLb(bo->vsl, SLT_Length, "%ju",
(uintmax_t)ObjGetLen(bo->wrk, bo->fetch_objcore));
}
......
......@@ -307,8 +307,8 @@ VDP_gunzip(struct req *req, enum vdp_action act, void **priv,
http_Unset(req->resp, H_Content_Encoding);
req->resp_len = -1;
if (req->objcore->flags & OC_F_INCOMPLETE)
return (0); /* No idea about length */
if (req->objcore->boc != NULL)
return (0); /* No idea about length (yet) */
p = ObjGetAttr(req->wrk, req->objcore, OA_GZIPBITS, &dl);
if (p == NULL || dl != 32)
......
......@@ -91,7 +91,7 @@ hsh_prealloc(struct worker *wrk)
if (wrk->nobjcore == NULL) {
wrk->nobjcore = ObjNew(wrk);
wrk->nobjcore->flags |= OC_F_BUSY | OC_F_INCOMPLETE;
wrk->nobjcore->flags |= OC_F_BUSY;
}
CHECK_OBJ_NOTNULL(wrk->nobjcore, OBJCORE_MAGIC);
......@@ -118,7 +118,7 @@ HSH_Private(struct worker *wrk)
AN(oc);
oc->refcnt = 1;
oc->objhead = private_oh;
oc->flags |= OC_F_PRIVATE | OC_F_BUSY | OC_F_INCOMPLETE;
oc->flags |= OC_F_PRIVATE | OC_F_BUSY;
Lck_Lock(&private_oh->mtx);
VTAILQ_INSERT_TAIL(&private_oh->objcs, oc, list);
private_oh->refcnt++;
......@@ -613,25 +613,6 @@ HSH_Fail(struct objcore *oc)
Lck_Lock(&oh->mtx);
oc->flags |= OC_F_FAILED;
oc->flags &= ~OC_F_INCOMPLETE;
Lck_Unlock(&oh->mtx);
}
/*---------------------------------------------------------------------
* Remove the busyobj from an objcore
*/
void
HSH_Complete(struct objcore *oc)
{
struct objhead *oh;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
oh = oc->objhead;
CHECK_OBJ(oh, OBJHEAD_MAGIC);
Lck_Lock(&oh->mtx);
oc->flags &= ~OC_F_INCOMPLETE;
Lck_Unlock(&oh->mtx);
}
......@@ -725,10 +706,13 @@ HSH_RefBoc(const struct objcore *oc)
assert(oc->refcnt > 0);
boc = oc->boc;
CHECK_OBJ_ORNULL(boc, BOC_MAGIC);
if (boc != NULL && boc->state < BOS_FINISHED)
boc->refcount++;
else
boc = NULL;
if (boc != NULL) {
assert(boc->refcount > 0);
if (boc->state < BOS_FINISHED)
boc->refcount++;
else
boc = NULL;
}
Lck_Unlock(&oh->mtx);
return (boc);
}
......
......@@ -104,7 +104,6 @@ struct objhead {
void HSH_Fail(struct objcore *);
void HSH_Unbusy(struct worker *, struct objcore *);
void HSH_Complete(struct objcore *oc);
void HSH_DeleteObjHead(struct worker *, struct objhead *oh);
int HSH_DerefObjHead(struct worker *, struct objhead **poh);
int HSH_DerefObjCore(struct worker *, struct objcore **ocp);
......
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