[master] e9e8d42 Eliminate bo->ws_o

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 15 12:25:43 CEST 2014


commit e9e8d4283b6c66379068224330bc842884aa3b8f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 15 10:25:04 2014 +0000

    Eliminate bo->ws_o

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 7373815..e6d5369 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -527,9 +527,6 @@ struct busyobj {
 	struct vsl_log		vsl[1];
 	struct dstat		*stats;
 
-	/* Workspace for object only needed during fetch */
-	struct ws		ws_o[1];
-
 	struct vsb		*synth_body;
 };
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index c4b4332..04df133 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -137,7 +137,6 @@ vbf_beresp2obj(struct busyobj *bo)
 	}
 
 	AZ(ObjSetU32(bo->vfc, OA_VXID, VXID(bo->vsl->wid)));
-	WS_Assert(bo->ws_o);
 
 	/* for HTTP_Encode() VSLH call */
 	bo->beresp->logtag = SLT_ObjMethod;
@@ -607,8 +606,6 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 
 	assert(bo->refcount >= 1);
 
-	AZ(WS_Overflowed(bo->ws_o));
-
 	assert (bo->state == BOS_REQ_DONE);
 
 	if (bo->do_stream) {
@@ -680,7 +677,6 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
 	AZ(ObjCopyAttr(bo->vfc, bo->ims_oc, OA_FLAGS));
 	AZ(ObjCopyAttr(bo->vfc, bo->ims_oc, OA_GZIPBITS));
 
-	AZ(WS_Overflowed(bo->ws_o));
 	if (bo->do_stream) {
 		HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
 		VBO_setstate(bo, BOS_STREAM);
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 99fc00f..1d6399f 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -407,12 +407,14 @@ ObjSetattr(const struct vfp_ctx *vc, enum obj_attr attr, ssize_t len,
 {
 	struct object *o;
 	void *retval = NULL;
+	struct storage *st;
 
 	CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(vc->bo, BUSYOBJ_MAGIC);
 	CHECK_OBJ_NOTNULL(vc->oc, OBJCORE_MAGIC);
 	o = obj_getobj(vc->oc, vc->stats);
 	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+	st = o->objstore;
 	switch (attr) {
 	case OA_ESIDATA:
 		o->esidata = objallocwithnuke(o->body->stevedore, vc->vsl,
@@ -431,8 +433,10 @@ ObjSetattr(const struct vfp_ctx *vc, enum obj_attr attr, ssize_t len,
 		retval = o->oa_gzipbits;
 		break;
 	case OA_HEADERS:
-		o->oa_http = (void*)WS_Alloc(vc->bo->ws_o, len);
-		AN(o->oa_http);
+		len = PRNDUP(len);
+		assert(st->len + len <= st->space);
+		o->oa_http = (void*)(st->ptr + st->len);
+		st->len += len;
 		retval = o->oa_http;
 		break;
 	case OA_LASTMODIFIED:
@@ -440,8 +444,10 @@ ObjSetattr(const struct vfp_ctx *vc, enum obj_attr attr, ssize_t len,
 		retval = o->oa_lastmodified;
 		break;
 	case OA_VARY:
-		o->oa_vary = (void*)WS_Alloc(vc->bo->ws_o, len);
-		AN(o->oa_vary);
+		len = PRNDUP(len);
+		assert(st->len + len <= st->space);
+		o->oa_vary = (void*)(st->ptr + st->len);
+		st->len += len;
 		retval = o->oa_vary;
 		break;
 	case OA_VXID:
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 7574638..c666d8a 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -342,7 +342,6 @@ pan_busyobj(const struct busyobj *bo)
 		pan_http("bereq", bo->bereq, 4);
 	if (bo->beresp->ws != NULL)
 		pan_http("beresp", bo->beresp, 4);
-	pan_ws(bo->ws_o, 4);
 	if (bo->fetch_objcore)
 		pan_objcore("FETCH", bo->fetch_objcore);
 	if (bo->ims_oc)
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index fbdcda1..7e4cea4 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -223,10 +223,6 @@ STV_MkObject(struct stevedore *stv, struct busyobj *bo,
 	l = PRNDDN(ltot - sizeof *o);
 	assert(l >= soc->wsl);
 
-	WS_Init(bo->ws_o, "obj", o + 1, l);
-	WS_Assert(bo->ws_o);
-	assert(bo->ws_o->e <= (char*)ptr + ltot);
-
 	VTAILQ_INIT(&o->body->list);
 
 	bo->fetch_objcore->stobj->magic = STOREOBJ_MAGIC;
@@ -260,9 +256,10 @@ stv_default_allocobj(struct stevedore *stv, struct busyobj *bo,
 		stv->free(st);
 		return (NULL);
 	}
-	ltot = st->len = st->space;
+	ltot = st->space;
 	o = STV_MkObject(stv, bo, st->ptr, ltot, soc);
 	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+	st->len = sizeof(*o);
 	o->objstore = st;
 	bo->stats->n_object++;
 	return (o);
diff --git a/bin/varnishd/storage/storage_persistent.c b/bin/varnishd/storage/storage_persistent.c
index 281561b..3e54208 100644
--- a/bin/varnishd/storage/storage_persistent.c
+++ b/bin/varnishd/storage/storage_persistent.c
@@ -532,13 +532,14 @@ smp_allocobj(struct stevedore *stv, struct busyobj *bo,
 		return (NULL);
 
 	assert(st->space >= ltot);
-	ltot = st->len = st->space;
+	ltot = st->space;
 
 	o = STV_MkObject(stv, bo, st->ptr, ltot, soc);
 	AN(bo->fetch_objcore->stobj->stevedore);
 	assert(bo->fetch_objcore->stobj->stevedore == stv);
 	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
 	o->objstore = st;
+	st->len = sizeof(*o);
 	bo->stats->n_object++;
 
 	oc = bo->fetch_objcore;



More information about the varnish-commit mailing list