[3.0] ef07e1d Pass priv2 member instead of objcore pointer, thats all we need.

Tollef Fog Heen tfheen at varnish-cache.org
Wed Aug 17 11:25:22 CEST 2011


commit ef07e1ddbc3cd6642e9ddc5f6168b1d5399e896c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jun 20 07:38:19 2011 +0000

    Pass priv2 member instead of objcore pointer, thats all we need.

diff --git a/bin/varnishd/storage_persistent_silo.c b/bin/varnishd/storage_persistent_silo.c
index d4ccf1e..a1eb98b 100644
--- a/bin/varnishd/storage_persistent_silo.c
+++ b/bin/varnishd/storage_persistent_silo.c
@@ -308,15 +308,13 @@ smp_close_seg(struct smp_sc *sc, struct smp_seg *sg)
  */
 
 static struct smp_object *
-smp_find_so(const struct smp_seg *sg, const struct objcore *oc)
+smp_find_so(const struct smp_seg *sg, unsigned priv2)
 {
 	struct smp_object *so;
-	unsigned smp_idx;
 
-	smp_idx = oc->priv2;
-	assert(smp_idx > 0);
-	assert(smp_idx <= sg->p.lobjlist);
-	so = &sg->objs[sg->p.lobjlist - smp_idx];
+	assert(priv2 > 0);
+	assert(priv2 <= sg->p.lobjlist);
+	so = &sg->objs[sg->p.lobjlist - priv2];
 	return (so);
 }
 
@@ -390,7 +388,7 @@ smp_oc_getobj(struct worker *wrk, struct objcore *oc)
 		AZ(oc->flags & OC_F_NEEDFIXUP);
 
 	CAST_OBJ_NOTNULL(sg, oc->priv, SMP_SEG_MAGIC);
-	so = smp_find_so(sg, oc);
+	so = smp_find_so(sg, oc->priv2);
 
 	o = (void*)(sg->sc->base + so->ptr);
 	/*
@@ -456,7 +454,7 @@ smp_oc_updatemeta(struct objcore *oc)
 
 	CAST_OBJ_NOTNULL(sg, oc->priv, SMP_SEG_MAGIC);
 	CHECK_OBJ_NOTNULL(sg->sc, SMP_SC_MAGIC);
-	so = smp_find_so(sg, oc);
+	so = smp_find_so(sg, oc->priv2);
 
 	mttl = EXP_Grace(NULL, o);
 
@@ -481,7 +479,7 @@ smp_oc_freeobj(struct objcore *oc)
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 
 	CAST_OBJ_NOTNULL(sg, oc->priv, SMP_SEG_MAGIC);
-	so = smp_find_so(sg, oc);
+	so = smp_find_so(sg, oc->priv2);
 
 	Lck_Lock(&sg->sc->mtx);
 	so->ttl = 0;



More information about the varnish-commit mailing list