[master] 8c8b500 Drop the BOS_COMMITTED state, and rename BOS_FETCHING to BOS_STREAM which is really what client threads care about.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Feb 25 12:33:25 CET 2014
commit 8c8b5007403f80ecb4cca537d1fb8f7bc0648e1f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Feb 25 09:27:23 2014 +0000
Drop the BOS_COMMITTED state, and rename BOS_FETCHING to BOS_STREAM
which is really what client threads care about.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 623e5ba..5db6e22 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -503,8 +503,7 @@ oc_getlru(const struct objcore *oc)
enum busyobj_state_e {
BOS_INVALID = 0, /* don't touch (yet) */
BOS_REQ_DONE, /* beresp.* can be examined */
- BOS_COMMITTED, /* beresp.* can be examined */
- BOS_FETCHING, /* beresp.* can be examined */
+ BOS_STREAM, /* beresp.* can be examined */
BOS_FINISHED, /* object is complete */
BOS_FAILED, /* something went wrong */
};
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 914c6d4..b64b2bb 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -395,7 +395,6 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
}
assert(bo->state == BOS_REQ_DONE);
- VBO_setstate(bo, BOS_COMMITTED);
if (bo->do_esi)
bo->do_stream = 0;
@@ -509,13 +508,13 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
assert(bo->refcount >= 1);
AZ(WS_Overflowed(bo->ws_o));
- if (bo->do_stream)
- HSH_Unbusy(&wrk->stats, obj->objcore);
- if (bo->state == BOS_COMMITTED)
- VBO_setstate(bo, BOS_FETCHING);
- else if (bo->state != BOS_FAILED)
- WRONG("Wrong bo->state");
+ assert (bo->state == BOS_REQ_DONE);
+
+ if (bo->do_stream) {
+ HSH_Unbusy(&wrk->stats, obj->objcore);
+ VBO_setstate(bo, BOS_STREAM);
+ }
if (bo->htc.body_status != BS_NONE) {
assert(bo->htc.body_status != BS_ERROR);
@@ -530,7 +529,10 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if (bo->state == BOS_FAILED) {
wrk->stats.fetch_failed++;
} else {
- assert(bo->state == BOS_FETCHING);
+ if (bo->do_stream)
+ assert(bo->state == BOS_STREAM);
+ else
+ assert(bo->state == BOS_REQ_DONE);
VSLb(bo->vsl, SLT_Length, "%zd", obj->len);
@@ -622,7 +624,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
AZ(WS_Overflowed(bo->ws_o));
- VBO_setstate(bo, BOS_FETCHING);
+ VBO_setstate(bo, BOS_STREAM);
HSH_Unbusy(&wrk->stats, obj->objcore);
@@ -849,9 +851,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
if (mode == VBF_BACKGROUND) {
VBO_waitstate(bo, BOS_REQ_DONE);
} else {
- VBO_waitstate(bo, BOS_FETCHING);
- if (!bo->do_stream)
- VBO_waitstate(bo, BOS_FINISHED);
+ VBO_waitstate(bo, BOS_STREAM);
assert(bo->state != BOS_FAILED || (oc->flags & OC_F_FAILED));
}
VBO_DerefBusyObj(wrk, &bo);
diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index ea928e4..b21ca15 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -61,7 +61,7 @@ VFP_Error(struct busyobj *bo, const char *fmt, ...)
va_list ap;
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
- assert(bo->state >= BOS_COMMITTED);
+ assert(bo->state >= BOS_REQ_DONE);
if (bo->state < BOS_FAILED) {
va_start(ap, fmt);
VSLbv(bo->vsl, SLT_FetchError, fmt, ap);
More information about the varnish-commit
mailing list