[master] 91d192c Eliminate wrk->sp
Poul-Henning Kamp
phk at varnish-cache.org
Sun Feb 19 11:08:46 CET 2012
commit 91d192cd2963dcd1e5ccbeaa5aee7bd9a3ab6cf2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sun Feb 19 10:08:32 2012 +0000
Eliminate wrk->sp
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 7eb3372..9a560c3 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -310,8 +310,6 @@ struct worker {
pthread_cond_t cond;
- struct sess *sp;
-
struct VCL_conf *vcl;
struct vsl_log vsl[1];
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index 8848682..07e7f5e 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -229,7 +229,6 @@ VCA_FailSess(struct worker *wrk)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CAST_OBJ_NOTNULL(wa, (void*)wrk->aws->f, WRK_ACCEPT_MAGIC);
- AZ(wrk->sp);
AZ(close(wa->acceptsock));
wrk->stats.sess_drop++;
vca_pace_bad();
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 338b3ab..ad0817e 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -1552,10 +1552,6 @@ CNT_Session(struct sess *sp)
struct worker *wrk;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-#if 0
- CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- MPL_AssertSane(req);
-#endif
wrk = sp->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
@@ -1590,10 +1586,6 @@ CNT_Session(struct sess *sp)
*/
for (done = 0; !done; ) {
assert(sp->wrk == wrk);
-#if 0
- CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- MPL_AssertSane(req);
-#endif
/*
* This is a good place to be paranoid about the various
* pointers still pointing to the things we expect.
diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index c6253b2..29d467c 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -438,7 +438,6 @@ pool_herder(void *priv)
VSC_C_main->threads--;
VSC_C_main->threads_destroyed++;
Lck_Unlock(&pool_mtx);
- AZ(wrk->sp);
wrk->task.func = NULL;
wrk->task.priv = NULL;
AZ(pthread_cond_signal(&wrk->cond));
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 542ec2e..10a8182 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -142,17 +142,11 @@ ses_pool_task(struct worker *wrk, void *arg)
AZ(wrk->aws->r);
wrk->lastused = NAN;
THR_SetSession(sp);
- if (wrk->sp == NULL)
- wrk->sp = sp;
- else
- assert(wrk->sp == sp);
AZ(sp->wrk);
sp->wrk = wrk;
CNT_Session(sp);
- sp = NULL;
- /* Cannot access sp now */
+ sp = NULL; /* Cannot access sp any longer */
THR_SetSession(NULL);
- wrk->sp = NULL;
WS_Assert(wrk->aws);
AZ(wrk->busyobj);
AZ(wrk->wrw);
@@ -171,20 +165,20 @@ void
SES_pool_accept_task(struct worker *wrk, void *arg)
{
struct sesspool *pp;
+ struct sess *sp;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CAST_OBJ_NOTNULL(pp, arg, SESSPOOL_MAGIC);
/* Turn accepted socket into a session */
- AZ(wrk->sp);
AN(wrk->aws->r);
- wrk->sp = ses_new(pp);
- if (wrk->sp == NULL) {
+ sp = ses_new(pp);
+ if (sp == NULL) {
VCA_FailSess(wrk);
} else {
- VCA_SetupSess(wrk, wrk->sp);
- wrk->sp->step = STP_FIRST;
- ses_pool_task(wrk, wrk->sp);
+ VCA_SetupSess(wrk, sp);
+ sp->step = STP_FIRST;
+ ses_pool_task(wrk, sp);
}
}
More information about the varnish-commit
mailing list