[master] b115ccf Move the ws_o structure from struct obj to busyobj, and shave 48 bytes off stored objects.

Poul-Henning Kamp phk at varnish-cache.org
Thu Sep 5 12:28:30 CEST 2013


commit b115ccfd98486aff00da25012a1118626b3177f4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Sep 5 10:24:32 2013 +0000

    Move the ws_o structure from struct obj to busyobj, and shave 48 bytes
    off stored objects.
    
    We used to need this in struct obj, so we could munge obj.http, but
    we don't allow that any more.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 7c9b1e0..5be6aab 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -565,6 +565,9 @@ struct busyobj {
 
 	struct vsl_log		vsl[1];
 	struct dstat		*stats;
+
+	/* Workspace for object only needed during fetch */
+	struct ws		ws_o[1];
 };
 
 /* Object structure --------------------------------------------------*/
@@ -578,8 +581,6 @@ struct object {
 	struct storage		*objstore;
 	struct objcore		*objcore;
 
-	struct ws		ws_o[1];
-
 	uint8_t			*vary;
 	unsigned		hits;
 	uint16_t		response;
@@ -604,7 +605,6 @@ struct object {
 	struct storage		*esidata;
 
 	double			last_use;
-
 };
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 4c926e9..a79e6cc 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -380,7 +380,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 
 	obj->vxid = bo->vsl->wid;
 	obj->response = bo->err_code;
-	WS_Assert(obj->ws_o);
+	WS_Assert(bo->ws_o);
 
 	/* Filter into object */
 	hp = bo->beresp;
@@ -408,7 +408,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 		AN(obj->objcore->ban);
 	}
 
-	AZ(obj->ws_o->overflow);
+	AZ(bo->ws_o->overflow);
 	if (bo->do_stream)
 		HSH_Unbusy(&wrk->stats, obj->objcore);
 
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index fdd7bb3..ff70390 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -208,7 +208,6 @@ pan_object(const struct object *o)
 
 	VSB_printf(pan_vsp, "  obj = %p {\n", o);
 	VSB_printf(pan_vsp, "    vxid = %u,\n", o->vxid);
-	pan_ws(o->ws_o, 4);
 	pan_http("obj", o->http, 4);
 	VSB_printf(pan_vsp, "    len = %jd,\n", (intmax_t)o->len);
 	VSB_printf(pan_vsp, "    store = {\n");
@@ -279,6 +278,7 @@ 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);
 	VSB_printf(pan_vsp, "  }\n");
 }
 
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 5b36c08..2d64d2d 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -277,11 +277,11 @@ STV_MkObject(struct stevedore *stv, struct busyobj *bo,
 	assert(l >= soc->wsl);
 
 	o->http = HTTP_create(o + 1, soc->nhttp);
-	WS_Init(o->ws_o, "obj", (char *)(o + 1) + soc->lhttp, soc->wsl);
-	WS_Assert(o->ws_o);
-	assert(o->ws_o->e <= (char*)ptr + ltot);
+	WS_Init(bo->ws_o, "obj", (char *)(o + 1) + soc->lhttp, soc->wsl);
+	WS_Assert(bo->ws_o);
+	assert(bo->ws_o->e <= (char*)ptr + ltot);
 
-	HTTP_Setup(o->http, o->ws_o, bo->vsl, HTTP_Obj);
+	HTTP_Setup(o->http, bo->ws_o, bo->vsl, HTTP_Obj);
 	o->http->magic = HTTP_MAGIC;
 	o->exp = bo->exp;
 	VTAILQ_INIT(&o->store);



More information about the varnish-commit mailing list