r3650 - branches/2.0/varnish-cache/bin/varnishd

tfheen at projects.linpro.no tfheen at projects.linpro.no
Fri Feb 6 12:27:55 CET 2009


Author: tfheen
Date: 2009-02-06 12:27:55 +0100 (Fri, 06 Feb 2009)
New Revision: 3650

Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache.h
   branches/2.0/varnish-cache/bin/varnishd/cache_hash.c
   branches/2.0/varnish-cache/bin/varnishd/cache_lck.c
   branches/2.0/varnish-cache/bin/varnishd/cache_vrt_re.c
   branches/2.0/varnish-cache/bin/varnishd/hash_classic.c
   branches/2.0/varnish-cache/bin/varnishd/hash_simple_list.c
Log:
Merge r3450: Various minor cleanups while we wait...



Modified: branches/2.0/varnish-cache/bin/varnishd/cache.h
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-02-06 11:16:08 UTC (rev 3649)
+++ branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-02-06 11:27:55 UTC (rev 3650)
@@ -509,7 +509,7 @@
 void Lck__Unlock(struct lock *lck, const char *p, const char *f, int l);
 int Lck__Trylock(struct lock *lck, const char *p, const char *f, int l);
 void Lck__New(struct lock *lck, const char *w);
-void Lck__Assert(struct lock *lck, int held);
+void Lck__Assert(const struct lock *lck, int held);
 
 /* public interface: */
 void LCK_Init(void);

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_hash.c	2009-02-06 11:16:08 UTC (rev 3649)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_hash.c	2009-02-06 11:27:55 UTC (rev 3650)
@@ -83,6 +83,8 @@
 HSH_Prealloc(struct sess *sp)
 {
 	struct worker *w;
+	struct objhead *oh;
+	struct object *o;
 	struct storage *st;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
@@ -90,47 +92,39 @@
 	w = sp->wrk;
 
 	if (w->nobjhead == NULL) {
-		w->nobjhead = calloc(sizeof *w->nobjhead, 1);
-		XXXAN(w->nobjhead);
-		w->nobjhead->magic = OBJHEAD_MAGIC;
-		w->nobjhead->refcnt = 1;
-		VTAILQ_INIT(&w->nobjhead->objects);
-		VTAILQ_INIT(&w->nobjhead->waitinglist);
-		Lck_New(&w->nobjhead->mtx);
+		ALLOC_OBJ(oh, OBJHEAD_MAGIC);
+		XXXAN(oh);
+		oh->refcnt = 1;
+		VTAILQ_INIT(&oh->objects);
+		VTAILQ_INIT(&oh->waitinglist);
+		Lck_New(&oh->mtx);
+		w->nobjhead = oh;
 		VSL_stats->n_objecthead++;
 	} else
 		CHECK_OBJ_NOTNULL(w->nobjhead, OBJHEAD_MAGIC);
 
-#if 0
-	/* Make sure there is space enough for the hash-string */
-	if (w->nobjhead->hashlen < sp->lhashptr) {
-		w->objhead->hash = realloc(w->objhead->hash, sp->lhashptr);
-		w->objhead->hashlen = sp->lhashptr;
-		AN(w->objhead->hash);
-	}
-#endif
-
 	if (w->nobj == NULL) {
 		st = STV_alloc(sp, params->obj_workspace);
 		XXXAN(st);
 		assert(st->space > sizeof *w->nobj);
-		w->nobj = (void *)st->ptr; /* XXX: align ? */
-		st->len = sizeof *w->nobj;
-		memset(w->nobj, 0, sizeof *w->nobj);
-		w->nobj->objstore = st;
-		WS_Init(w->nobj->ws_o, "obj",
+		o = (void *)st->ptr; /* XXX: align ? */
+		st->len = sizeof *o;
+		memset(o, 0, sizeof *o);
+		o->objstore = st;
+		WS_Init(o->ws_o, "obj",
 		    st->ptr + st->len, st->space - st->len);
 		st->len = st->space;
-		WS_Assert(w->nobj->ws_o);
-		http_Setup(w->nobj->http, w->nobj->ws_o);
-		w->nobj->magic = OBJECT_MAGIC;
-		w->nobj->http->magic = HTTP_MAGIC;
-		w->nobj->busy = 1;
-		w->nobj->refcnt = 1;
-		w->nobj->grace = NAN;
-		w->nobj->entered = NAN;
-		VTAILQ_INIT(&w->nobj->store);
-		VTAILQ_INIT(&w->nobj->esibits);
+		WS_Assert(o->ws_o);
+		http_Setup(o->http, o->ws_o);
+		o->magic = OBJECT_MAGIC;
+		o->http->magic = HTTP_MAGIC;
+		o->busy = 1;
+		o->refcnt = 1;
+		o->grace = NAN;
+		o->entered = NAN;
+		VTAILQ_INIT(&o->store);
+		VTAILQ_INIT(&o->esibits);
+		w->nobj = o;
 		VSL_stats->n_object++;
 
 	} else

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_lck.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_lck.c	2009-02-06 11:16:08 UTC (rev 3649)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_lck.c	2009-02-06 11:27:55 UTC (rev 3650)
@@ -125,7 +125,7 @@
 }
 
 void
-Lck__Assert(struct lock *lck, int held)
+Lck__Assert(const struct lock *lck, int held)
 {
 	struct ilck *ilck;
 

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_vrt_re.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_vrt_re.c	2009-02-06 11:16:08 UTC (rev 3649)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_vrt_re.c	2009-02-06 11:27:55 UTC (rev 3650)
@@ -43,7 +43,6 @@
 
 #include "shmlog.h"
 #include "vrt.h"
-#include "vsb.h"
 #include "vcl.h"
 #include "cache.h"
 

Modified: branches/2.0/varnish-cache/bin/varnishd/hash_classic.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/hash_classic.c	2009-02-06 11:16:08 UTC (rev 3649)
+++ branches/2.0/varnish-cache/bin/varnishd/hash_classic.c	2009-02-06 11:27:55 UTC (rev 3650)
@@ -124,7 +124,7 @@
 	int i;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	CHECK_OBJ_ORNULL(noh, OBJHEAD_MAGIC);
+	CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC);
 
 	digest = ~0U;
 	for (u = 0; u < sp->ihashptr; u += 2) {

Modified: branches/2.0/varnish-cache/bin/varnishd/hash_simple_list.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/hash_simple_list.c	2009-02-06 11:16:08 UTC (rev 3649)
+++ branches/2.0/varnish-cache/bin/varnishd/hash_simple_list.c	2009-02-06 11:27:55 UTC (rev 3650)
@@ -71,6 +71,8 @@
 	struct objhead *oh;
 	int i;
 
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC);
 	Lck_Lock(&hsl_mtx);
 	VTAILQ_FOREACH(oh, &hsl_head, hoh_list) {
 		i = HSH_Compare(sp, oh);



More information about the varnish-commit mailing list