Commit 94d7a686 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make SES_Charge() and SES_ReleaseReq() take struct req* argument

instead of struct sess*
parent 6dfad3d4
...@@ -925,13 +925,13 @@ unsigned WRW_WriteH(const struct worker *w, const txt *hh, const char *suf); ...@@ -925,13 +925,13 @@ unsigned WRW_WriteH(const struct worker *w, const txt *hh, const char *suf);
/* cache_session.c [SES] */ /* cache_session.c [SES] */
void SES_Close(struct sess *sp, const char *reason); void SES_Close(struct sess *sp, const char *reason);
void SES_Delete(struct sess *sp, const char *reason, double now); 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); struct sesspool *SES_NewPool(struct pool *pp, unsigned pool_no);
void SES_DeletePool(struct sesspool *sp); void SES_DeletePool(struct sesspool *sp);
int SES_Schedule(struct sess *sp); int SES_Schedule(struct sess *sp);
void SES_Handle(struct sess *sp, double now); void SES_Handle(struct sess *sp, double now);
struct req *SES_GetReq(struct sess *sp); 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; pool_func_t SES_pool_accept_task;
/* cache_shmlog.c */ /* cache_shmlog.c */
......
...@@ -191,8 +191,8 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -191,8 +191,8 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
if (when < now || tmo == 0) { if (when < now || tmo == 0) {
sp->t_rx = NAN; sp->t_rx = NAN;
wrk->stats.sess_herd++; wrk->stats.sess_herd++;
SES_Charge(wrk, sp); SES_Charge(wrk, req);
SES_ReleaseReq(sp); SES_ReleaseReq(req);
WAIT_Enter(sp); WAIT_Enter(sp);
return (1); return (1);
} }
...@@ -206,7 +206,7 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -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); SES_Delete(sp, why, now);
return (1); return (1);
} }
...@@ -1624,7 +1624,7 @@ CNT_Request(struct worker *wrk, struct req *req) ...@@ -1624,7 +1624,7 @@ CNT_Request(struct worker *wrk, struct req *req)
CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC); CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC);
} }
if (done == 1) if (done == 1)
SES_Charge(wrk, req->sp); SES_Charge(wrk, req);
req->wrk = NULL; req->wrk = NULL;
......
...@@ -424,7 +424,7 @@ HSH_Lookup(struct req *req) ...@@ -424,7 +424,7 @@ HSH_Lookup(struct req *req)
if (cache_param->diag_bitmap & 0x20) if (cache_param->diag_bitmap & 0x20)
VSLb(req->vsl, SLT_Debug, VSLb(req->vsl, SLT_Debug,
"on waiting list <%p>", oh); "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 * The objhead reference transfers to the sess, we get it
* back when the sess comes off the waiting list and * back when the sess comes off the waiting list and
......
...@@ -61,16 +61,18 @@ struct sesspool { ...@@ -61,16 +61,18 @@ struct sesspool {
*/ */
void void
SES_Charge(struct worker *wrk, struct sess *sp) SES_Charge(struct worker *wrk, struct req *req)
{ {
struct sess *sp;
struct acct *a; struct acct *a;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(wrk, WORKER_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; a = &wrk->acct_tmp;
sp->req->req_bodybytes += a->bodybytes; req->req_bodybytes += a->bodybytes;
#define ACCT(foo) \ #define ACCT(foo) \
wrk->stats.s_##foo += a->foo; \ wrk->stats.s_##foo += a->foo; \
...@@ -259,7 +261,7 @@ SES_Delete(struct sess *sp, const char *reason, double now) ...@@ -259,7 +261,7 @@ SES_Delete(struct sess *sp, const char *reason, double now)
if (sp->req != NULL) { if (sp->req != NULL) {
AZ(sp->req->vcl); AZ(sp->req->vcl);
SES_ReleaseReq(sp); SES_ReleaseReq(sp->req);
} }
if (*sp->addr == '\0') if (*sp->addr == '\0')
...@@ -346,21 +348,23 @@ SES_GetReq(struct sess *sp) ...@@ -346,21 +348,23 @@ SES_GetReq(struct sess *sp)
} }
void void
SES_ReleaseReq(struct sess *sp) SES_ReleaseReq(struct req *req)
{ {
struct sess *sp;
struct sesspool *pp; struct sesspool *pp;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
assert(sp->req == req);
pp = sp->sesspool; pp = sp->sesspool;
CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC); CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC);
AN(pp->pool); AN(pp->pool);
CHECK_OBJ_NOTNULL(sp->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
AN(sp->req->sp); MPL_AssertSane(req);
assert(sp->req->sp == sp); VSL_Flush(req->vsl, 0);
MPL_AssertSane(sp->req); req->sp = NULL;
VSL_Flush(sp->req->vsl, 0); MPL_Free(pp->mpl_req, req);
sp->req->sp = NULL;
MPL_Free(pp->mpl_req, sp->req);
sp->req = NULL; sp->req = NULL;
THR_SetRequest(NULL); THR_SetRequest(NULL);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment