[master] c739268 Change wrk->stats.bla to wrk->stats->bla since it trips me up every single time, and it is inconsistent with how we do it elsewhere.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Sep 16 09:49:56 CEST 2014
commit c739268039fb958ae729e4c7a7d97d4cce04621d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Sep 16 07:49:11 2014 +0000
Change wrk->stats.bla to wrk->stats->bla since it trips me up every
single time, and it is inconsistent with how we do it elsewhere.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index f1da513..b16edbb 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -348,7 +348,7 @@ struct worker {
struct waitinglist *nwaitinglist;
struct busyobj *nbo;
void *nhashpriv;
- struct dstat stats;
+ struct dstat stats[1];
struct pool_task task;
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index 7afcef6..f178d10 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -331,7 +331,7 @@ VCA_FailSess(struct worker *wrk)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CAST_OBJ_NOTNULL(wa, (void*)wrk->aws->f, WRK_ACCEPT_MAGIC);
AZ(close(wa->acceptsock));
- wrk->stats.sess_drop++;
+ wrk->stats->sess_drop++;
vca_pace_bad();
WS_Release(wrk->aws, 0);
}
@@ -355,7 +355,7 @@ VCA_SetupSess(struct worker *wrk, struct sess *sp)
assert(wa->acceptaddrlen <= vsa_suckaddr_len);
AN(VSA_Build(sess_remote_addr(sp), &wa->acceptaddr, wa->acceptaddrlen));
vca_pace_good();
- wrk->stats.sess_conn++;
+ wrk->stats->sess_conn++;
WS_Release(wrk->aws, 0);
if (need_test) {
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 6fe3bba..a7fd546 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -939,7 +939,7 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req)
CHECK_OBJ_NOTNULL(b, BAN_MAGIC);
if (b->flags & BANS_FLAG_COMPLETED)
continue;
- if (ban_evaluate(b->spec, oc, &wrk->stats, req->http, &tests))
+ if (ban_evaluate(b->spec, oc, wrk->stats, req->http, &tests))
break;
}
@@ -958,12 +958,12 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req)
if (b == oc->ban) { /* not banned */
oc->ban = b0;
- ObjUpdateMeta(oc, &wrk->stats);
+ ObjUpdateMeta(oc, wrk->stats);
return (0);
} else {
oc->ban = NULL;
VSLb(vsl, SLT_ExpBan, "%u banned lookup",
- ObjGetXID(oc, &wrk->stats));
+ ObjGetXID(oc, wrk->stats));
VSC_C_main->bans_obj_killed++;
EXP_Rearm(oc, oc->exp.t_origin, 0, 0, 0); // XXX fake now
return (1);
@@ -1088,7 +1088,7 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt,
continue;
}
tests = 0;
- i = ban_evaluate(bl->spec, oc, &wrk->stats, NULL, &tests);
+ i = ban_evaluate(bl->spec, oc, wrk->stats, NULL, &tests);
VSC_C_main->bans_lurker_tested++;
VSC_C_main->bans_lurker_tests_tested += tests;
if (i)
@@ -1096,11 +1096,11 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt,
}
if (i) {
VSLb(vsl, SLT_ExpBan, "%u banned by lurker",
- ObjGetXID(oc, &wrk->stats));
+ ObjGetXID(oc, wrk->stats));
EXP_Rearm(oc, oc->exp.t_origin, 0, 0, 0); // XXX fake now
VSC_C_main->bans_lurker_obj_killed++;
}
- (void)HSH_DerefObjCore(&wrk->stats, &oc);
+ (void)HSH_DerefObjCore(wrk->stats, &oc);
}
}
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index a0c0666..dd7834f 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -197,7 +197,7 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
if (bo->fetch_objcore != NULL) {
AN(wrk);
- (void)HSH_DerefObjCore(&wrk->stats, &bo->fetch_objcore);
+ (void)HSH_DerefObjCore(wrk->stats, &bo->fetch_objcore);
}
VCL_Rel(&bo->vcl);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index e315e82..9f2059e 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -269,7 +269,7 @@ ESI_Deliver(struct req *req)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
- p = ObjGetattr(req->objcore, &req->wrk->stats, OA_ESIDATA, &l);
+ p = ObjGetattr(req->objcore, req->wrk->stats, OA_ESIDATA, &l);
AN(p);
assert(l > 0);
e = p + l;
@@ -484,7 +484,7 @@ ESI_DeliverChild(struct req *req)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
- if (!ObjCheckFlag(req->objcore, &req->wrk->stats, OF_GZIPED)) {
+ if (!ObjCheckFlag(req->objcore, req->wrk->stats, OF_GZIPED)) {
oi = ObjIterBegin(req->objcore, req->wrk);
do {
ois = ObjIter(req->objcore, oi, &sp, &sl);
@@ -500,13 +500,13 @@ ESI_DeliverChild(struct req *req)
* padding it, as necessary, to a byte boundary.
*/
- p = ObjGetattr(req->objcore, &req->wrk->stats, OA_GZIPBITS, &l);
+ p = ObjGetattr(req->objcore, req->wrk->stats, OA_GZIPBITS, &l);
AN(p);
assert(l == 24);
start = vbe64dec(p);
last = vbe64dec(p + 8);
stop = vbe64dec(p + 16);
- olen = ObjGetLen(req->objcore, &req->wrk->stats);
+ olen = ObjGetLen(req->objcore, req->wrk->stats);
assert(start > 0 && start < olen * 8);
assert(last > 0 && last < olen * 8);
assert(stop > 0 && stop < olen * 8);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 1cc223b..0b9772e 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -386,13 +386,13 @@ exp_inbox(struct exp_priv *ep, struct objcore *oc, double now)
binheap_delete(ep->heap, oc->timer_idx);
}
assert(oc->timer_idx == BINHEAP_NOIDX);
- (void)HSH_DerefObjCore(&ep->wrk->stats, &oc);
+ (void)HSH_DerefObjCore(ep->wrk->stats, &oc);
return;
}
if (flags & OC_EF_MOVE) {
oc->timer_when = EXP_When(&oc->exp);
- ObjUpdateMeta(oc, &ep->wrk->stats);
+ ObjUpdateMeta(oc, ep->wrk->stats);
}
VSLb(&ep->vsl, SLT_ExpKill, "EXP_When p=%p e=%.9f f=0x%x", oc,
@@ -464,9 +464,9 @@ exp_expire(struct exp_priv *ep, double now)
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
VSLb(&ep->vsl, SLT_ExpKill, "EXP_Expired x=%u t=%.0f",
- ObjGetXID(oc, &ep->wrk->stats),
+ ObjGetXID(oc, ep->wrk->stats),
EXP_Ttl(NULL, &oc->exp) - now);
- (void)HSH_DerefObjCore(&ep->wrk->stats, &oc);
+ (void)HSH_DerefObjCore(ep->wrk->stats, &oc);
return (0);
}
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 56e4eed..e8dc047 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -322,7 +322,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
* no matter what the headers might say.
* [RFC2516 4.3 p33]
*/
- wrk->stats.fetch_head++;
+ wrk->stats->fetch_head++;
bo->htc->body_status = BS_NONE;
} else if (http_GetStatus(bo->beresp) <= 199) {
/*
@@ -330,33 +330,33 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
* [RFC2616 4.3 p33]
* ... but we should never see them.
*/
- wrk->stats.fetch_1xx++;
+ wrk->stats->fetch_1xx++;
bo->htc->body_status = BS_ERROR;
} else if (http_IsStatus(bo->beresp, 204)) {
/*
* 204 is "No Content", obviously don't expect a body.
* [RFC2616 10.2.5 p60]
*/
- wrk->stats.fetch_204++;
+ wrk->stats->fetch_204++;
bo->htc->body_status = BS_NONE;
} else if (http_IsStatus(bo->beresp, 304)) {
/*
* 304 is "Not Modified" it has no body.
* [RFC2616 10.3.5 p63]
*/
- wrk->stats.fetch_304++;
+ wrk->stats->fetch_304++;
bo->htc->body_status = BS_NONE;
} else if (bo->htc->body_status == BS_CHUNKED) {
- wrk->stats.fetch_chunked++;
+ wrk->stats->fetch_chunked++;
} else if (bo->htc->body_status == BS_LENGTH) {
assert(bo->htc->content_length > 0);
- wrk->stats.fetch_length++;
+ wrk->stats->fetch_length++;
} else if (bo->htc->body_status == BS_EOF) {
- wrk->stats.fetch_eof++;
+ wrk->stats->fetch_eof++;
} else if (bo->htc->body_status == BS_ERROR) {
- wrk->stats.fetch_bad++;
+ wrk->stats->fetch_bad++;
} else if (bo->htc->body_status == BS_NONE) {
- wrk->stats.fetch_none++;
+ wrk->stats->fetch_none++;
} else {
WRONG("wrong bodystatus");
}
@@ -611,7 +611,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
assert (bo->state == BOS_REQ_DONE);
if (bo->do_stream) {
- HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
+ HSH_Unbusy(wrk->stats, bo->fetch_objcore);
VBO_setstate(bo, BOS_STREAM);
}
@@ -638,7 +638,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
assert(bo->state == BOS_STREAM);
else {
assert(bo->state == BOS_REQ_DONE);
- HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
+ HSH_Unbusy(wrk->stats, bo->fetch_objcore);
}
/* Recycle the backend connection before setting BOS_FINISHED to
@@ -680,7 +680,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
AZ(ObjCopyAttr(bo->vfc, bo->ims_oc, OA_GZIPBITS));
if (bo->do_stream) {
- HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
+ HSH_Unbusy(wrk->stats, bo->fetch_objcore);
VBO_setstate(bo, BOS_STREAM);
}
@@ -707,7 +707,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
return (F_STP_FAIL);
if (!bo->do_stream)
- HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
+ HSH_Unbusy(wrk->stats, bo->fetch_objcore);
assert(al == ol);
assert(ObjGetLen(bo->fetch_objcore, bo->stats) == al);
@@ -801,7 +801,7 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
VSB_delete(bo->synth_body);
bo->synth_body = NULL;
- HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
+ HSH_Unbusy(wrk->stats, bo->fetch_objcore);
VBO_setstate(bo, BOS_FINISHED);
return (F_STP_DONE);
}
@@ -824,7 +824,7 @@ vbf_stp_fail(struct worker *wrk, struct busyobj *bo)
EXP_Rearm(bo->fetch_objcore,
bo->fetch_objcore->exp.t_origin, 0, 0, 0);
}
- wrk->stats.fetch_failed++;
+ wrk->stats->fetch_failed++;
VBO_setstate(bo, BOS_FAILED);
return (F_STP_DONE);
}
@@ -857,7 +857,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
assert(isnan(bo->t_prev));
VSLb_ts_busyobj(bo, "Start", W_TIM_real(wrk));
- bo->stats = &wrk->stats;
+ bo->stats = wrk->stats;
while (stp != F_STP_DONE) {
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
@@ -895,7 +895,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
AZ(bo->fetch_objcore->busyobj);
if (bo->ims_oc != NULL)
- (void)HSH_DerefObjCore(&wrk->stats, &bo->ims_oc);
+ (void)HSH_DerefObjCore(wrk->stats, &bo->ims_oc);
bo->stats = NULL;
@@ -951,7 +951,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
AZ(bo->ims_oc);
if (oldoc != NULL &&
- ObjCheckFlag(oldoc, &req->wrk->stats, OF_IMSCAND)) {
+ ObjCheckFlag(oldoc, req->wrk->stats, OF_IMSCAND)) {
assert(oldoc->refcnt > 0);
HSH_Ref(oldoc);
bo->ims_oc = oldoc;
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 9bcc322..b102928 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -75,7 +75,7 @@ HSH_NewObjCore(struct worker *wrk)
ALLOC_OBJ(oc, OBJCORE_MAGIC);
XXXAN(oc);
- wrk->stats.n_objectcore++;
+ wrk->stats->n_objectcore++;
oc->flags |= OC_F_BUSY;
return (oc);
}
@@ -110,7 +110,7 @@ hsh_prealloc(struct worker *wrk)
if (wrk->nobjhead == NULL) {
wrk->nobjhead = hsh_newobjhead();
- wrk->stats.n_objecthead++;
+ wrk->stats->n_objecthead++;
}
CHECK_OBJ_NOTNULL(wrk->nobjhead, OBJHEAD_MAGIC);
@@ -119,7 +119,7 @@ hsh_prealloc(struct worker *wrk)
XXXAN(wl);
VTAILQ_INIT(&wl->list);
wrk->nwaitinglist = wl;
- wrk->stats.n_waitinglist++;
+ wrk->stats->n_waitinglist++;
}
CHECK_OBJ_NOTNULL(wrk->nwaitinglist, WAITINGLIST_MAGIC);
@@ -155,19 +155,19 @@ HSH_Cleanup(struct worker *wrk)
if (wrk->nobjcore != NULL) {
FREE_OBJ(wrk->nobjcore);
- wrk->stats.n_objectcore--;
+ wrk->stats->n_objectcore--;
wrk->nobjcore = NULL;
}
if (wrk->nobjhead != NULL) {
Lck_Delete(&wrk->nobjhead->mtx);
FREE_OBJ(wrk->nobjhead);
wrk->nobjhead = NULL;
- wrk->stats.n_objecthead--;
+ wrk->stats->n_objecthead--;
}
if (wrk->nwaitinglist != NULL) {
FREE_OBJ(wrk->nwaitinglist);
wrk->nwaitinglist = NULL;
- wrk->stats.n_waitinglist--;
+ wrk->stats->n_waitinglist--;
}
if (wrk->nhashpriv != NULL) {
/* XXX: If needed, add slinger method for this */
@@ -306,8 +306,8 @@ HSH_Insert(struct worker *wrk, const void *digest, struct objcore *oc)
/* NB: do not deref objhead the new object inherits our reference */
oc->objhead = oh;
Lck_Unlock(&oh->mtx);
- wrk->stats.n_objectcore++;
- wrk->stats.n_vampireobject++;
+ wrk->stats->n_objectcore++;
+ wrk->stats->n_vampireobject++;
}
/*---------------------------------------------------------------------
@@ -424,7 +424,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
if (BAN_CheckObject(wrk, oc, req))
continue;
- vary = ObjGetattr(oc, &wrk->stats, OA_VARY, NULL);
+ vary = ObjGetattr(oc, wrk->stats, OA_VARY, NULL);
if (vary != NULL && !VRY_Match(req, vary))
continue;
@@ -437,7 +437,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
if (oh->hits < LONG_MAX)
oh->hits++;
Lck_Unlock(&oh->mtx);
- assert(HSH_DerefObjHead(&wrk->stats, &oh));
+ assert(HSH_DerefObjHead(wrk->stats, &oh));
*ocp = oc;
return (HSH_HIT);
}
@@ -465,7 +465,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
oh->hits++;
Lck_Unlock(&oh->mtx);
if (retval == HSH_EXP)
- assert(HSH_DerefObjHead(&wrk->stats, &oh));
+ assert(HSH_DerefObjHead(wrk->stats, &oh));
*ocp = exp_oc;
return (retval);
}
@@ -497,7 +497,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
VSLb(req->vsl, SLT_Debug, "hit busy obj <%p>", oh);
}
- wrk->stats.busy_sleep++;
+ wrk->stats->busy_sleep++;
/*
* The objhead reference transfers to the sess, we get it
* back when the sess comes off the waiting list and
@@ -602,7 +602,7 @@ double keep)
oc = ocp[n];
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
EXP_Rearm(oc, now, ttl, grace, keep);
- (void)HSH_DerefObjCore(&wrk->stats, &oc);
+ (void)HSH_DerefObjCore(wrk->stats, &oc);
}
} while (more);
WS_Release(wrk->aws, 0);
diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c
index 1d21ecc..f58ea70 100644
--- a/bin/varnishd/cache/cache_http1_deliver.c
+++ b/bin/varnishd/cache/cache_http1_deliver.c
@@ -97,9 +97,9 @@ v1d_dorange(struct req *req, struct busyobj *bo, const char *r)
/* We must snapshot the length if we're streaming from the backend */
if (bo != NULL)
- len = VBO_waitlen(bo, &req->wrk->stats, -1);
+ len = VBO_waitlen(bo, req->wrk->stats, -1);
else
- len = ObjGetLen(req->objcore, &req->wrk->stats);
+ len = ObjGetLen(req->objcore, req->wrk->stats);
if (strncmp(r, "bytes=", 6))
return;
@@ -239,7 +239,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
req->res_mode = 0;
- if (!req->disable_esi && ObjGetattr(req->objcore, &req->wrk->stats,
+ if (!req->disable_esi && ObjGetattr(req->objcore, req->wrk->stats,
OA_ESIDATA, NULL) != NULL) {
/* In ESI mode, we can't know the aggregate length */
req->res_mode &= ~RES_LEN;
@@ -252,11 +252,11 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
/* XXX: Not happy with this convoluted test */
req->res_mode |= RES_LEN;
if (!(req->objcore->flags & OC_F_PASS) ||
- ObjGetLen(req->objcore, &req->wrk->stats) != 0) {
+ ObjGetLen(req->objcore, req->wrk->stats) != 0) {
http_Unset(req->resp, H_Content_Length);
http_PrintfHeader(req->resp,
"Content-Length: %ju", (uintmax_t)ObjGetLen(
- req->objcore, &req->wrk->stats));
+ req->objcore, req->wrk->stats));
}
}
@@ -267,7 +267,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
}
if (cache_param->http_gzip_support &&
- ObjCheckFlag(req->objcore, &req->wrk->stats, OF_GZIPED) &&
+ ObjCheckFlag(req->objcore, req->wrk->stats, OF_GZIPED) &&
!RFC2616_Req_Gzip(req->http)) {
/*
* We don't know what it uncompresses to
@@ -340,13 +340,13 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
l = -1;
while (req->objcore->busyobj) {
assert(bo != NULL);
- l = VBO_waitlen(bo, &req->wrk->stats, l);
+ l = VBO_waitlen(bo, req->wrk->stats, l);
}
ESI_DeliverChild(req);
} else if (req->res_mode & RES_GUNZIP ||
(req->res_mode & RES_ESI_CHILD &&
!req->gzip_resp &&
- ObjCheckFlag(req->objcore, &req->wrk->stats, OF_GZIPED))) {
+ ObjCheckFlag(req->objcore, req->wrk->stats, OF_GZIPED))) {
VDP_push(req, VDP_gunzip);
req->vgz = VGZ_NewUngzip(req->vsl, "U D -");
AZ(VGZ_WrwInit(req->vgz));
diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c
index 2a6b781..970ea24 100644
--- a/bin/varnishd/cache/cache_http1_fsm.c
+++ b/bin/varnishd/cache/cache_http1_fsm.c
@@ -142,7 +142,7 @@ http1_wait(struct sess *sp, struct worker *wrk, struct req *req)
when = sp->t_idle + cache_param->timeout_linger;
tmo = (int)(1e3 * (when - now));
if (when < now || tmo == 0) {
- wrk->stats.sess_herd++;
+ wrk->stats->sess_herd++;
SES_ReleaseReq(req);
WAIT_Enter(sp);
return (REQ_FSM_DONE);
@@ -161,7 +161,7 @@ http1_wait(struct sess *sp, struct worker *wrk, struct req *req)
}
}
req->acct.req_hdrbytes += Tlen(req->htc->rxbuf);
- CNT_AcctLogCharge(&wrk->stats, req);
+ CNT_AcctLogCharge(wrk->stats, req);
SES_ReleaseReq(req);
assert(why != SC_NULL);
SES_Delete(sp, why, now);
@@ -202,7 +202,7 @@ http1_cleanup(struct sess *sp, struct worker *wrk, struct req *req)
/* Charge and log byte counters */
AN(req->vsl->wid);
- CNT_AcctLogCharge(&wrk->stats, req);
+ CNT_AcctLogCharge(wrk->stats, req);
req->req_bodybytes = 0;
req->resp_hdrbytes = 0;
req->resp_bodybytes = 0;
@@ -226,7 +226,7 @@ http1_cleanup(struct sess *sp, struct worker *wrk, struct req *req)
SES_Close(sp, req->doclose);
if (sp->fd < 0) {
- wrk->stats.sess_closed++;
+ wrk->stats->sess_closed++;
AZ(req->vcl);
SES_ReleaseReq(req);
SES_Delete(sp, SC_NULL, NAN);
@@ -239,12 +239,12 @@ http1_cleanup(struct sess *sp, struct worker *wrk, struct req *req)
if (HTTP1_Reinit(req->htc) == HTTP1_COMPLETE) {
AZ(req->vsl->wid);
req->t_first = req->t_req = sp->t_idle;
- wrk->stats.sess_pipeline++;
+ wrk->stats->sess_pipeline++;
req->acct.req_hdrbytes += Tlen(req->htc->rxbuf);
return (SESS_DONE_RET_START);
} else {
if (Tlen(req->htc->rxbuf))
- wrk->stats.sess_readahead++;
+ wrk->stats->sess_readahead++;
return (SESS_DONE_RET_WAIT);
}
}
@@ -287,7 +287,7 @@ http1_dissect(struct worker *wrk, struct req *req)
/* If we could not even parse the request, just close */
if (req->err_code != 0) {
VSLbt(req->vsl, SLT_HttpGarbage, req->htc->rxbuf);
- wrk->stats.client_req_400++;
+ wrk->stats->client_req_400++;
r = write(req->sp->fd, r_400, strlen(r_400));
if (r > 0)
req->acct.resp_hdrbytes += r;
@@ -311,7 +311,7 @@ http1_dissect(struct worker *wrk, struct req *req)
if (http_GetHdr(req->http, H_Expect, &p)) {
if (strcasecmp(p, "100-continue")) {
- wrk->stats.client_req_417++;
+ wrk->stats->client_req_417++;
req->err_code = 417;
r = write(req->sp->fd, r_417, strlen(r_417));
if (r > 0)
@@ -329,8 +329,8 @@ http1_dissect(struct worker *wrk, struct req *req)
http_Unset(req->http, H_Expect);
}
- wrk->stats.client_req++;
- wrk->stats.s_req++;
+ wrk->stats->client_req++;
+ wrk->stats->s_req++;
AZ(req->err_code);
req->ws_req = WS_Snapshot(req->ws);
@@ -378,7 +378,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
*/
if (req->req_step == R_STP_LOOKUP && VTCP_check_hup(sp->fd)) {
AN(req->hash_objhead);
- (void)HSH_DerefObjHead(&wrk->stats, &req->hash_objhead);
+ (void)HSH_DerefObjHead(wrk->stats, &req->hash_objhead);
AZ(req->hash_objhead);
SES_Close(sp, SC_REM_CLOSE);
sdr = http1_cleanup(sp, wrk, req);
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 53b686f..f846541 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -104,7 +104,7 @@ ObjIterBegin(struct objcore *oc, struct worker *wrk)
return (om->objiterbegin(oc, wrk));
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
- obj = obj_getobj(oc, &wrk->stats);
+ obj = obj_getobj(oc, wrk->stats);
CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
ALLOC_OBJ(oi, OBJITER_MAGIC);
if (oi == NULL)
@@ -152,7 +152,7 @@ ObjIter(struct objcore *oc, void *oix, void **p, ssize_t *l)
} else {
ol = oi->len;
while (1) {
- nl = VBO_waitlen(oi->bo, &oi->wrk->stats, ol);
+ nl = VBO_waitlen(oi->bo, oi->wrk->stats, ol);
if (nl != ol)
break;
if (oi->bo->state == BOS_FINISHED)
diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index f4de5f3..fc41856 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -101,23 +101,23 @@ pool_sumstat(const struct dstat *src)
}
void
-Pool_Sumstat(struct worker *w)
+Pool_Sumstat(struct worker *wrk)
{
Lck_Lock(&wstat_mtx);
- pool_sumstat(&w->stats);
+ pool_sumstat(wrk->stats);
Lck_Unlock(&wstat_mtx);
- memset(&w->stats, 0, sizeof w->stats);
+ memset(wrk->stats, 0, sizeof *wrk->stats);
}
static int
-Pool_TrySumstat(struct worker *w)
+Pool_TrySumstat(struct worker *wrk)
{
if (Lck_Trylock(&wstat_mtx))
return (0);
- pool_sumstat(&w->stats);
+ pool_sumstat(wrk->stats);
Lck_Unlock(&wstat_mtx);
- memset(&w->stats, 0, sizeof w->stats);
+ memset(wrk->stats, 0, sizeof *wrk->stats);
return (1);
}
@@ -222,7 +222,7 @@ pool_accept(struct worker *wrk, void *arg)
return;
}
if (VCA_Accept(ps->lsock, wa) < 0) {
- wrk->stats.sess_fail++;
+ wrk->stats->sess_fail++;
/* We're going to pace in vca anyway... */
(void)Pool_TrySumstat(wrk);
continue;
@@ -374,12 +374,12 @@ Pool_Work_Thread(void *priv, struct worker *wrk)
VTAILQ_REMOVE(&pp->back_queue, tp, list);
}
- if ((tp == NULL && wrk->stats.summs > 0) ||
- (wrk->stats.summs >= cache_param->wthread_stats_rate))
- pool_addstat(pp->a_stat, &wrk->stats);
+ if ((tp == NULL && wrk->stats->summs > 0) ||
+ (wrk->stats->summs >= cache_param->wthread_stats_rate))
+ pool_addstat(pp->a_stat, wrk->stats);
if (tp != NULL) {
- wrk->stats.summs++;
+ wrk->stats->summs++;
} else if (pp->b_stat != NULL && pp->a_stat->summs) {
/* Nothing to do, push pool stats into global pool */
tps.func = pool_stat_summ;
@@ -401,7 +401,7 @@ Pool_Work_Thread(void *priv, struct worker *wrk)
VCL_Rel(&wrk->vcl);
} while (wrk->task.func == NULL);
tp = &wrk->task;
- wrk->stats.summs++;
+ wrk->stats->summs++;
}
Lck_Unlock(&pp->mtx);
diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index dadd25c..1befd7d 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -174,7 +174,7 @@ VRB_Free(struct req *req)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
if (req->body_oc != NULL) {
- ObjFreeObj(req->body_oc, &req->wrk->stats);
+ ObjFreeObj(req->body_oc, req->wrk->stats);
FREE_OBJ(req->body_oc);
req->body_oc = NULL;
}
@@ -222,14 +222,14 @@ VRB_Cache(struct req *req, ssize_t maxsize)
}
req->body_oc = HSH_NewObjCore(req->wrk);
- XXXAN(STV_NewObject(req->body_oc, req->vsl, &req->wrk->stats,
+ XXXAN(STV_NewObject(req->body_oc, req->vsl, req->wrk->stats,
TRANSIENT_STORAGE, 8));
VFP_Setup(vfc);
vfc->http = req->http;
vfc->vsl = req->vsl;
vfc->oc = req->body_oc;
- vfc->stats = &req->wrk->stats;
+ vfc->stats = req->wrk->stats;
V1F_Setup_Fetch(vfc, req->htc);
if (VFP_Open(vfc) < 0) {
@@ -254,7 +254,7 @@ VRB_Cache(struct req *req, ssize_t maxsize)
req->acct.req_bodybytes += l;
if (yet >= l)
yet -= l;
- ObjExtend(req->body_oc, &req->wrk->stats, l);
+ ObjExtend(req->body_oc, req->wrk->stats, l);
}
} while (vfps == VFP_OK);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 1125e36..457b97e 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -103,13 +103,13 @@ cnt_deliver(struct worker *wrk, struct req *req)
HTTP_Setup(req->resp, req->ws, req->vsl, SLT_RespMethod);
AZ(HTTP_Decode(req->resp,
- ObjGetattr(req->objcore, &req->wrk->stats, OA_HEADERS, NULL)));
+ ObjGetattr(req->objcore, req->wrk->stats, OA_HEADERS, NULL)));
http_ForceField(req->resp, HTTP_HDR_PROTO, "HTTP/1.1");
- if (req->wrk->stats.cache_hit)
+ if (req->wrk->stats->cache_hit)
http_PrintfHeader(req->resp,
"X-Varnish: %u %u", VXID(req->vsl->wid),
- ObjGetXID(req->objcore, &wrk->stats));
+ ObjGetXID(req->objcore, wrk->stats));
else
http_PrintfHeader(req->resp,
"X-Varnish: %u", VXID(req->vsl->wid));
@@ -127,7 +127,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
http_SetHeader(req->resp, "Via: 1.1 varnish-v4");
if (cache_param->http_gzip_support &&
- ObjCheckFlag(req->objcore, &req->wrk->stats, OF_GZIPED) &&
+ ObjCheckFlag(req->objcore, req->wrk->stats, OF_GZIPED) &&
!RFC2616_Req_Gzip(req->http))
RFC2616_Weaken_Etag(req->resp);
@@ -140,7 +140,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
if (wrk->handling != VCL_RET_DELIVER) {
assert(req->objcore == req->objcore);
- (void)HSH_DerefObjCore(&wrk->stats, &req->objcore);
+ (void)HSH_DerefObjCore(wrk->stats, &req->objcore);
http_Teardown(req->resp);
switch (wrk->handling) {
@@ -188,11 +188,11 @@ cnt_deliver(struct worker *wrk, struct req *req)
*/
while (req->objcore->busyobj != NULL)
(void)usleep(100000);
- ObjSlim(req->objcore, &wrk->stats);
+ ObjSlim(req->objcore, wrk->stats);
}
assert(WRW_IsReleased(wrk));
- (void)HSH_DerefObjCore(&wrk->stats, &req->objcore);
+ (void)HSH_DerefObjCore(wrk->stats, &req->objcore);
http_Teardown(req->resp);
return (REQ_FSM_DONE);
}
@@ -220,7 +220,7 @@ cnt_synth(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- wrk->stats.s_synth++;
+ wrk->stats->s_synth++;
now = W_TIM_real(wrk);
VSLb_ts_req(req, "Process", now);
@@ -295,13 +295,13 @@ cnt_fetch(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
- wrk->stats.s_fetch++;
+ wrk->stats->s_fetch++;
(void)VRB_Ignore(req);
if (req->objcore->flags & OC_F_FAILED) {
req->err_code = 503;
req->req_step = R_STP_SYNTH;
- (void)HSH_DerefObjCore(&wrk->stats, &req->objcore);
+ (void)HSH_DerefObjCore(wrk->stats, &req->objcore);
AZ(req->objcore);
return (REQ_FSM_MORE);
}
@@ -399,16 +399,16 @@ cnt_lookup(struct worker *wrk, struct req *req)
/* Found a hit-for-pass */
VSLb(req->vsl, SLT_Debug, "XXXX HIT-FOR-PASS");
VSLb(req->vsl, SLT_HitPass, "%u",
- ObjGetXID(req->objcore, &wrk->stats));
+ ObjGetXID(req->objcore, wrk->stats));
AZ(boc);
- (void)HSH_DerefObjCore(&wrk->stats, &req->objcore);
- wrk->stats.cache_hitpass++;
+ (void)HSH_DerefObjCore(wrk->stats, &req->objcore);
+ wrk->stats->cache_hitpass++;
req->req_step = R_STP_PASS;
return (REQ_FSM_MORE);
}
VSLb(req->vsl, SLT_Hit, "%u",
- ObjGetXID(req->objcore, &wrk->stats));
+ ObjGetXID(req->objcore, wrk->stats));
VCL_hit_method(req->vcl, wrk, req, NULL, req->http->ws);
@@ -422,7 +422,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
} else {
(void)VRB_Ignore(req);// XXX: handle err
}
- wrk->stats.cache_hit++;
+ wrk->stats->cache_hit++;
req->req_step = R_STP_DELIVER;
return (REQ_FSM_MORE);
case VCL_RET_FETCH:
@@ -431,7 +431,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
req->ims_oc = oc;
req->req_step = R_STP_MISS;
} else {
- (void)HSH_DerefObjCore(&wrk->stats, &req->objcore);
+ (void)HSH_DerefObjCore(wrk->stats, &req->objcore);
/*
* We don't have a busy object, so treat this
* like a pass
@@ -449,7 +449,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
req->req_step = R_STP_SYNTH;
break;
case VCL_RET_PASS:
- wrk->stats.cache_hit++;
+ wrk->stats->cache_hit++;
req->req_step = R_STP_PASS;
break;
default:
@@ -457,10 +457,10 @@ cnt_lookup(struct worker *wrk, struct req *req)
}
/* Drop our object, we won't need it */
- (void)HSH_DerefObjCore(&wrk->stats, &req->objcore);
+ (void)HSH_DerefObjCore(wrk->stats, &req->objcore);
if (boc != NULL) {
- (void)HSH_DerefObjCore(&wrk->stats, &boc);
+ (void)HSH_DerefObjCore(wrk->stats, &boc);
VRY_Clear(req);
}
@@ -493,11 +493,11 @@ cnt_miss(struct worker *wrk, struct req *req)
VCL_miss_method(req->vcl, wrk, req, NULL, req->http->ws);
switch (wrk->handling) {
case VCL_RET_FETCH:
- wrk->stats.cache_miss++;
+ wrk->stats->cache_miss++;
VBF_Fetch(wrk, req, req->objcore, req->ims_oc, VBF_NORMAL);
req->req_step = R_STP_FETCH;
if (req->ims_oc != NULL)
- (void)HSH_DerefObjCore(&wrk->stats, &req->ims_oc);
+ (void)HSH_DerefObjCore(wrk->stats, &req->ims_oc);
return (REQ_FSM_MORE);
case VCL_RET_SYNTH:
req->req_step = R_STP_SYNTH;
@@ -513,8 +513,8 @@ cnt_miss(struct worker *wrk, struct req *req)
}
VRY_Clear(req);
if (req->ims_oc != NULL)
- (void)HSH_DerefObjCore(&wrk->stats, &req->ims_oc);
- AZ(HSH_DerefObjCore(&wrk->stats, &req->objcore));
+ (void)HSH_DerefObjCore(wrk->stats, &req->ims_oc);
+ AZ(HSH_DerefObjCore(wrk->stats, &req->objcore));
return (REQ_FSM_MORE);
}
@@ -553,7 +553,7 @@ cnt_pass(struct worker *wrk, struct req *req)
req->req_step = R_STP_RESTART;
break;
case VCL_RET_FETCH:
- wrk->stats.s_pass++;
+ wrk->stats->s_pass++;
req->objcore = HSH_Private(wrk);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
VBF_Fetch(wrk, req, req->objcore, NULL, VBF_PASS);
@@ -592,7 +592,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->vcl, VCL_CONF_MAGIC);
- wrk->stats.s_pipe++;
+ wrk->stats->s_pipe++;
bo = VBO_GetBusyObj(wrk, req);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
VSLb(bo->vsl, SLT_Begin, "bereq %u pipe", VXID(req->vsl->wid));
@@ -828,7 +828,7 @@ cnt_purge(struct worker *wrk, struct req *req)
HSH_Purge(wrk, boc->objhead, 0, 0, 0);
- AZ(HSH_DerefObjCore(&wrk->stats, &boc));
+ AZ(HSH_DerefObjCore(wrk->stats, &boc));
VCL_purge_method(req->vcl, wrk, req, NULL, req->http->ws);
switch (wrk->handling) {
diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index 51ba2c4..6f27269 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -225,7 +225,7 @@ RFC2616_Do_Cond(const struct req *req)
ims = VTIM_parse(p);
if (ims > req->t_req) /* [RFC2616 14.25] */
return (0);
- AZ(ObjGetDouble(req->objcore, &req->wrk->stats,
+ AZ(ObjGetDouble(req->objcore, req->wrk->stats,
OA_LASTMODIFIED, &lm));
if (lm > ims)
return (0);
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 6aa07b4..ca4574f 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -200,7 +200,7 @@ SES_pool_accept_task(struct worker *wrk, void *arg)
VCA_FailSess(wrk);
return;
}
- wrk->stats.s_sess++;
+ wrk->stats->s_sess++;
sp->t_open = VTIM_real();
sp->t_idle = sp->t_open;
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index e8c5d9a..13c04dc 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -128,7 +128,7 @@ VRT_GetHdr(const struct vrt_ctx *ctx, const struct gethdr_s *hs)
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC);
return(HTTP_GetHdrPack(ctx->req->objcore,
- &ctx->req->wrk->stats, hs->what));
+ ctx->req->wrk->stats, hs->what));
}
hp = vrt_selecthttp(ctx, hs->where);
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 451f516..59b3c6f 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -148,7 +148,7 @@ VRT_r_obj_status(const struct vrt_ctx *ctx)
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC);
- return (HTTP_GetStatusPack(ctx->req->objcore, &ctx->req->wrk->stats));
+ return (HTTP_GetStatusPack(ctx->req->objcore, ctx->req->wrk->stats));
}
const char *
@@ -159,7 +159,7 @@ VRT_r_obj_proto(const struct vrt_ctx *ctx)
CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC);
return (HTTP_GetHdrPack(ctx->req->objcore,
- &ctx->req->wrk->stats, ":proto"));
+ ctx->req->wrk->stats, ":proto"));
}
const char *
@@ -170,7 +170,7 @@ VRT_r_obj_reason(const struct vrt_ctx *ctx)
CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC);
return (HTTP_GetHdrPack(ctx->req->objcore,
- &ctx->req->wrk->stats, ":reason"));
+ ctx->req->wrk->stats, ":reason"));
}
/*--------------------------------------------------------------------
diff --git a/bin/varnishd/hash/hash_critbit.c b/bin/varnishd/hash/hash_critbit.c
index 4c7e4b5..0f7b7ec 100644
--- a/bin/varnishd/hash/hash_critbit.c
+++ b/bin/varnishd/hash/hash_critbit.c
@@ -363,7 +363,7 @@ hcb_cleaner(struct worker *wrk, void *priv)
}
VTAILQ_FOREACH_SAFE(oh, &dead_h, hoh_list, oh2) {
VTAILQ_REMOVE(&dead_h, oh, hoh_list);
- HSH_DeleteObjHead(&wrk->stats, oh);
+ HSH_DeleteObjHead(wrk->stats, oh);
}
Lck_Lock(&hcb_mtx);
VSTAILQ_CONCAT(&dead_y, &cool_y);
@@ -432,7 +432,7 @@ hcb_lookup(struct worker *wrk, const void *digest, struct objhead **noh)
/* First try in read-only mode without holding a lock */
- wrk->stats.hcb_nolock++;
+ wrk->stats->hcb_nolock++;
oh = hcb_insert(wrk, &hcb_root, digest, NULL);
if (oh != NULL) {
Lck_Lock(&oh->mtx);
More information about the varnish-commit
mailing list