[master] c0d6265 Eliminate HSH_Complete(), the boc->state takes care of it.
Poul-Henning Kamp
phk at FreeBSD.org
Sat Feb 6 13:00:56 CET 2016
commit c0d62658c7dc535fb1b2db1ed69517b8ec833808
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sat Feb 6 12:00:37 2016 +0000
Eliminate HSH_Complete(), the boc->state takes care of it.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 33c40ed..cfd17bb 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -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)
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 35a6dd6..2b2d200 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -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));
}
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index 0b8d3a7..98523a0 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -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)
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 11714f9..d58e070 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -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);
}
diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h
index 9a64916..b4b7bcd 100644
--- a/bin/varnishd/hash/hash_slinger.h
+++ b/bin/varnishd/hash/hash_slinger.h
@@ -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);
More information about the varnish-commit
mailing list