[master] 94d7a68 Make SES_Charge() and SES_ReleaseReq() take struct req* argument instead of struct sess*
Poul-Henning Kamp
phk at varnish-cache.org
Mon Jun 25 10:35:11 CEST 2012
commit 94d7a686b0e553be881d378b6e5f4060123b56d4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jun 25 08:34:37 2012 +0000
Make SES_Charge() and SES_ReleaseReq() take struct req* argument
instead of struct sess*
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 8499a12..436bd20 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -925,13 +925,13 @@ unsigned WRW_WriteH(const struct worker *w, const txt *hh, const char *suf);
/* cache_session.c [SES] */
void SES_Close(struct sess *sp, const char *reason);
void SES_Delete(struct sess *sp, const char *reason, double now);
-void SES_Charge(struct worker *, struct sess *);
+void SES_Charge(struct worker *, struct req *);
struct sesspool *SES_NewPool(struct pool *pp, unsigned pool_no);
void SES_DeletePool(struct sesspool *sp);
int SES_Schedule(struct sess *sp);
void SES_Handle(struct sess *sp, double now);
struct req *SES_GetReq(struct sess *sp);
-void SES_ReleaseReq(struct sess *sp);
+void SES_ReleaseReq(struct req *);
pool_func_t SES_pool_accept_task;
/* cache_shmlog.c */
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index bd28916..5ea1f48 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -191,8 +191,8 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
if (when < now || tmo == 0) {
sp->t_rx = NAN;
wrk->stats.sess_herd++;
- SES_Charge(wrk, sp);
- SES_ReleaseReq(sp);
+ SES_Charge(wrk, req);
+ SES_ReleaseReq(req);
WAIT_Enter(sp);
return (1);
}
@@ -206,7 +206,7 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
}
}
}
- SES_Charge(wrk, sp);
+ SES_Charge(wrk, req);
SES_Delete(sp, why, now);
return (1);
}
@@ -1624,7 +1624,7 @@ CNT_Request(struct worker *wrk, struct req *req)
CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC);
}
if (done == 1)
- SES_Charge(wrk, req->sp);
+ SES_Charge(wrk, req);
req->wrk = NULL;
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index d3976d8..a2710dd 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -424,7 +424,7 @@ HSH_Lookup(struct req *req)
if (cache_param->diag_bitmap & 0x20)
VSLb(req->vsl, SLT_Debug,
"on waiting list <%p>", oh);
- SES_Charge(req->wrk, req->sp);
+ SES_Charge(req->wrk, req);
/*
* The objhead reference transfers to the sess, we get it
* back when the sess comes off the waiting list and
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 57ad270..49bd3bb 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -61,16 +61,18 @@ struct sesspool {
*/
void
-SES_Charge(struct worker *wrk, struct sess *sp)
+SES_Charge(struct worker *wrk, struct req *req)
{
+ struct sess *sp;
struct acct *a;
- CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(sp->req, REQ_MAGIC);
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ sp = req->sp;
+ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
a = &wrk->acct_tmp;
- sp->req->req_bodybytes += a->bodybytes;
+ req->req_bodybytes += a->bodybytes;
#define ACCT(foo) \
wrk->stats.s_##foo += a->foo; \
@@ -259,7 +261,7 @@ SES_Delete(struct sess *sp, const char *reason, double now)
if (sp->req != NULL) {
AZ(sp->req->vcl);
- SES_ReleaseReq(sp);
+ SES_ReleaseReq(sp->req);
}
if (*sp->addr == '\0')
@@ -346,21 +348,23 @@ SES_GetReq(struct sess *sp)
}
void
-SES_ReleaseReq(struct sess *sp)
+SES_ReleaseReq(struct req *req)
{
+ struct sess *sp;
struct sesspool *pp;
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ assert(sp->req == req);
pp = sp->sesspool;
CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC);
AN(pp->pool);
- CHECK_OBJ_NOTNULL(sp->req, REQ_MAGIC);
- AN(sp->req->sp);
- assert(sp->req->sp == sp);
- MPL_AssertSane(sp->req);
- VSL_Flush(sp->req->vsl, 0);
- sp->req->sp = NULL;
- MPL_Free(pp->mpl_req, sp->req);
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ MPL_AssertSane(req);
+ VSL_Flush(req->vsl, 0);
+ req->sp = NULL;
+ MPL_Free(pp->mpl_req, req);
sp->req = NULL;
THR_SetRequest(NULL);
}
More information about the varnish-commit
mailing list