[master] 6699df5 Eliminate bo->fetch_obj
Poul-Henning Kamp
phk at FreeBSD.org
Mon Aug 11 13:56:05 CEST 2014
commit 6699df5903e6938e67a21a67bb215b950b5cc3d4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Aug 11 11:55:52 2014 +0000
Eliminate bo->fetch_obj
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 12712b5..47e4fa7 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -498,7 +498,6 @@ struct busyobj {
struct object *ims_obj;
struct objcore *ims_oc;
struct objcore *fetch_objcore;
- struct object *fetch_obj;
struct http_conn htc;
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index b657c03..aa5f2e5 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -139,9 +139,6 @@ vbf_beresp2obj(struct busyobj *bo)
CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
- AZ(bo->fetch_obj);
- bo->fetch_obj = obj;
-
if (vary != NULL) {
obj->vary = (void *)WS_Copy(obj->http->ws,
VSB_data(vary), varyl);
@@ -167,6 +164,8 @@ vbf_beresp2obj(struct busyobj *bo)
AZ(ObjSetDouble(bo->vfc, OA_LASTMODIFIED,
floor(bo->fetch_objcore->exp.t_origin)));
+ bo->vfc->body = obj->body;
+
return (0);
}
@@ -398,7 +397,6 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
static enum fetch_step
vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
{
- struct object *obj;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
@@ -478,8 +476,6 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
assert(WRW_IsReleased(wrk));
- obj = bo->fetch_obj;
- bo->vfc->body = obj->body;
if (bo->do_gzip || (bo->is_gzip && !bo->do_gunzip))
ObjSetFlag(bo->vfc, OF_GZIPED, 1);
@@ -501,7 +497,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
assert (bo->state == BOS_REQ_DONE);
if (bo->do_stream) {
- HSH_Unbusy(&wrk->stats, obj->objcore);
+ HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
VBO_setstate(bo, BOS_STREAM);
}
@@ -517,10 +513,8 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if (bo->vfc->failed && !bo->do_stream) {
assert(bo->state < BOS_STREAM);
- if (bo->fetch_objcore != NULL) {
+ if (bo->fetch_objcore != NULL)
ObjFreeObj(bo->fetch_objcore, bo->stats);
- bo->fetch_obj = NULL;
- }
return (F_STP_ERROR);
}
@@ -531,7 +525,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
assert(bo->state == BOS_STREAM);
else {
assert(bo->state == BOS_REQ_DONE);
- HSH_Unbusy(&wrk->stats, obj->objcore);
+ HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
}
/* Recycle the backend connection before setting BOS_FINISHED to
@@ -554,7 +548,6 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
static enum fetch_step
vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
{
- struct object *obj;
struct objiter *oi;
void *sp;
ssize_t sl, al, tl;
@@ -578,8 +571,6 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
}
AZ(vbf_beresp2obj(bo));
- obj = bo->fetch_obj;
- bo->vfc->body = obj->body;
if (ObjGetattr(bo->ims_oc, bo->stats, OA_ESIDATA, NULL) != NULL)
AZ(ObjCopyAttr(bo->vfc, bo->ims_oc, OA_ESIDATA));
@@ -589,7 +580,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
AZ(WS_Overflowed(bo->ws_o));
if (bo->do_stream) {
- HSH_Unbusy(&wrk->stats, obj->objcore);
+ HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
VBO_setstate(bo, BOS_STREAM);
}
@@ -622,7 +613,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
return (F_STP_FAIL);
if (!bo->do_stream)
- HSH_Unbusy(&wrk->stats, obj->objcore);
+ HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
assert(al == ol);
assert(ObjGetLen(bo->fetch_objcore, bo->stats) == al);
@@ -700,7 +691,6 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
if (vbf_beresp2obj(bo))
return (F_STP_FAIL);
- bo->vfc->body = bo->fetch_obj->body;
l = VSB_len(bo->synth_body);
if (l > 0) {
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 03ef16c..e130925 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -341,8 +341,6 @@ pan_busyobj(const struct busyobj *bo)
pan_ws(bo->ws_o, 4);
if (bo->fetch_objcore)
pan_objcore("FETCH", bo->fetch_objcore);
- if (bo->fetch_obj)
- pan_object("FETCH", bo->fetch_obj);
if (bo->ims_obj)
pan_object("IMS", bo->ims_obj);
VSB_printf(pan_vsp, " }\n");
More information about the varnish-commit
mailing list