Commit fe8ec801 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Argument strength-reduction: from worker to dstats

parent 2d49712f
...@@ -908,7 +908,7 @@ ban_lurker_work(const struct sess *sp, unsigned pass) ...@@ -908,7 +908,7 @@ ban_lurker_work(const struct sess *sp, unsigned pass)
if (cache_param->diag_bitmap & 0x80000) if (cache_param->diag_bitmap & 0x80000)
VSL(SLT_Debug, 0, "lurker done: %p %u %u", VSL(SLT_Debug, 0, "lurker done: %p %u %u",
oc, oc->flags & OC_F_LURK, pass); oc, oc->flags & OC_F_LURK, pass);
(void)HSH_Deref(sp->wrk, NULL, &o); (void)HSH_Deref(&sp->wrk->stats, NULL, &o);
VTIM_sleep(cache_param->ban_lurker_sleep); VTIM_sleep(cache_param->ban_lurker_sleep);
} }
Lck_AssertHeld(&ban_mtx); Lck_AssertHeld(&ban_mtx);
......
...@@ -289,7 +289,7 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -289,7 +289,7 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
HSH_Drop(wrk); HSH_Drop(wrk);
VBO_DerefBusyObj(wrk, &wrk->busyobj); VBO_DerefBusyObj(wrk, &wrk->busyobj);
} else { } else {
(void)HSH_Deref(wrk, NULL, &req->obj); (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
} }
AZ(req->obj); AZ(req->obj);
req->restarts++; req->restarts++;
...@@ -338,7 +338,7 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -338,7 +338,7 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req)
RES_WriteObj(sp); RES_WriteObj(sp);
assert(WRW_IsReleased(wrk)); assert(WRW_IsReleased(wrk));
(void)HSH_Deref(wrk, NULL, &req->obj); (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
http_Teardown(req->resp); http_Teardown(req->resp);
sp->step = STP_DONE; sp->step = STP_DONE;
return (0); return (0);
...@@ -641,7 +641,7 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -641,7 +641,7 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
if (req->objcore != NULL) { if (req->objcore != NULL) {
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
AZ(HSH_Deref(wrk, req->objcore, NULL)); AZ(HSH_Deref(&wrk->stats, req->objcore, NULL));
req->objcore = NULL; req->objcore = NULL;
} }
VBO_DerefBusyObj(wrk, &wrk->busyobj); VBO_DerefBusyObj(wrk, &wrk->busyobj);
...@@ -972,7 +972,7 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -972,7 +972,7 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
RES_StreamEnd(sp); RES_StreamEnd(sp);
assert(WRW_IsReleased(wrk)); assert(WRW_IsReleased(wrk));
(void)HSH_Deref(wrk, NULL, &req->obj); (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
VBO_DerefBusyObj(wrk, &wrk->busyobj); VBO_DerefBusyObj(wrk, &wrk->busyobj);
http_Teardown(req->resp); http_Teardown(req->resp);
sp->step = STP_DONE; sp->step = STP_DONE;
...@@ -1065,7 +1065,7 @@ cnt_hit(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -1065,7 +1065,7 @@ cnt_hit(struct sess *sp, struct worker *wrk, struct req *req)
} }
/* Drop our object, we won't need it */ /* Drop our object, we won't need it */
(void)HSH_Deref(wrk, NULL, &req->obj); (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
req->objcore = NULL; req->objcore = NULL;
switch(req->handling) { switch(req->handling) {
...@@ -1183,7 +1183,7 @@ cnt_lookup(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -1183,7 +1183,7 @@ cnt_lookup(struct sess *sp, struct worker *wrk, struct req *req)
if (oc->flags & OC_F_PASS) { if (oc->flags & OC_F_PASS) {
wrk->stats.cache_hitpass++; wrk->stats.cache_hitpass++;
WSP(sp, SLT_HitPass, "%u", req->obj->xid); WSP(sp, SLT_HitPass, "%u", req->obj->xid);
(void)HSH_Deref(wrk, NULL, &req->obj); (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
AZ(req->objcore); AZ(req->objcore);
sp->step = STP_PASS; sp->step = STP_PASS;
return (0); return (0);
...@@ -1242,7 +1242,7 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -1242,7 +1242,7 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req)
return (0); return (0);
} }
AZ(HSH_Deref(wrk, req->objcore, NULL)); AZ(HSH_Deref(&wrk->stats, req->objcore, NULL));
req->objcore = NULL; req->objcore = NULL;
http_Teardown(wrk->busyobj->bereq); http_Teardown(wrk->busyobj->bereq);
VBO_DerefBusyObj(wrk, &wrk->busyobj); VBO_DerefBusyObj(wrk, &wrk->busyobj);
......
...@@ -402,7 +402,7 @@ exp_timer(struct sess *sp, void *priv) ...@@ -402,7 +402,7 @@ exp_timer(struct sess *sp, void *priv)
o = oc_getobj(sp->wrk, oc); o = oc_getobj(sp->wrk, oc);
WSL(sp->wrk->vsl, SLT_ExpKill, 0, "%u %.0f", WSL(sp->wrk->vsl, SLT_ExpKill, 0, "%u %.0f",
oc_getxid(sp->wrk, oc), EXP_Ttl(NULL, o) - t); oc_getxid(sp->wrk, oc), EXP_Ttl(NULL, o) - t);
(void)HSH_Deref(sp->wrk, oc, NULL); (void)HSH_Deref(&sp->wrk->stats, oc, NULL);
} }
NEEDLESS_RETURN(NULL); NEEDLESS_RETURN(NULL);
} }
...@@ -446,7 +446,7 @@ EXP_NukeOne(struct worker *wrk, struct lru *lru) ...@@ -446,7 +446,7 @@ EXP_NukeOne(struct worker *wrk, struct lru *lru)
/* XXX: bad idea for -spersistent */ /* XXX: bad idea for -spersistent */
WSL(wrk->vsl, SLT_ExpKill, 0, "%u LRU", oc_getxid(wrk, oc)); WSL(wrk->vsl, SLT_ExpKill, 0, "%u LRU", oc_getxid(wrk, oc));
(void)HSH_Deref(wrk, oc, NULL); (void)HSH_Deref(&wrk->stats, oc, NULL);
return (1); return (1);
} }
......
...@@ -139,13 +139,13 @@ HSH_Cleanup(struct worker *wrk) ...@@ -139,13 +139,13 @@ HSH_Cleanup(struct worker *wrk)
} }
void void
HSH_DeleteObjHead(struct worker *wrk, struct objhead *oh) HSH_DeleteObjHead(struct dstat *ds, struct objhead *oh)
{ {
AZ(oh->refcnt); AZ(oh->refcnt);
assert(VTAILQ_EMPTY(&oh->objcs)); assert(VTAILQ_EMPTY(&oh->objcs));
Lck_Delete(&oh->mtx); Lck_Delete(&oh->mtx);
wrk->stats.n_objecthead--; ds->n_objecthead--;
FREE_OBJ(oh); FREE_OBJ(oh);
} }
...@@ -564,7 +564,7 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace) ...@@ -564,7 +564,7 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace)
o->exp.ttl = ttl; o->exp.ttl = ttl;
o->exp.grace = grace; o->exp.grace = grace;
EXP_Rearm(o); EXP_Rearm(o);
(void)HSH_Deref(sp->wrk, NULL, &o); (void)HSH_Deref(&sp->wrk->stats, NULL, &o);
} }
WS_Release(sp->req->ws, 0); WS_Release(sp->req->ws, 0);
} }
...@@ -588,7 +588,7 @@ HSH_Drop(struct worker *wrk) ...@@ -588,7 +588,7 @@ HSH_Drop(struct worker *wrk)
o->exp.ttl = -1.; o->exp.ttl = -1.;
if (o->objcore != NULL) /* Pass has no objcore */ if (o->objcore != NULL) /* Pass has no objcore */
HSH_Unbusy(wrk); HSH_Unbusy(wrk);
(void)HSH_Deref(wrk, NULL, &wrk->sp->req->obj); (void)HSH_Deref(&wrk->stats, NULL, &wrk->sp->req->obj);
} }
void void
...@@ -660,7 +660,7 @@ HSH_Ref(struct objcore *oc) ...@@ -660,7 +660,7 @@ HSH_Ref(struct objcore *oc)
*/ */
int int
HSH_Deref(struct worker *wrk, struct objcore *oc, struct object **oo) HSH_Deref(struct dstat *ds, struct objcore *oc, struct object **oo)
{ {
struct object *o = NULL; struct object *o = NULL;
struct objhead *oh; struct objhead *oh;
...@@ -683,7 +683,7 @@ HSH_Deref(struct worker *wrk, struct objcore *oc, struct object **oo) ...@@ -683,7 +683,7 @@ HSH_Deref(struct worker *wrk, struct objcore *oc, struct object **oo)
*/ */
STV_Freestore(o); STV_Freestore(o);
STV_free(o->objstore); STV_free(o->objstore);
wrk->stats.n_object--; ds->n_object--;
return (0); return (0);
} }
...@@ -713,16 +713,16 @@ HSH_Deref(struct worker *wrk, struct objcore *oc, struct object **oo) ...@@ -713,16 +713,16 @@ HSH_Deref(struct worker *wrk, struct objcore *oc, struct object **oo)
if (oc->methods != NULL) { if (oc->methods != NULL) {
oc_freeobj(oc); oc_freeobj(oc);
wrk->stats.n_object--; ds->n_object--;
} }
FREE_OBJ(oc); FREE_OBJ(oc);
wrk->stats.n_objectcore--; ds->n_objectcore--;
/* Drop our ref on the objhead */ /* Drop our ref on the objhead */
assert(oh->refcnt > 0); assert(oh->refcnt > 0);
if (hash->deref(oh)) if (hash->deref(oh))
return (0); return (0);
HSH_DeleteObjHead(wrk, oh); HSH_DeleteObjHead(ds, oh);
return (0); return (0);
} }
......
...@@ -359,7 +359,7 @@ hcb_cleaner(struct sess *sp, void *priv) ...@@ -359,7 +359,7 @@ hcb_cleaner(struct sess *sp, void *priv)
} }
VTAILQ_FOREACH_SAFE(oh, &dead_h, hoh_list, oh2) { VTAILQ_FOREACH_SAFE(oh, &dead_h, hoh_list, oh2) {
VTAILQ_REMOVE(&dead_h, oh, hoh_list); VTAILQ_REMOVE(&dead_h, oh, hoh_list);
HSH_DeleteObjHead(wrk, oh); HSH_DeleteObjHead(&wrk->stats, oh);
} }
Lck_Lock(&hcb_mtx); Lck_Lock(&hcb_mtx);
VSTAILQ_CONCAT(&dead_y, &cool_y); VSTAILQ_CONCAT(&dead_y, &cool_y);
......
...@@ -95,8 +95,8 @@ struct objhead { ...@@ -95,8 +95,8 @@ struct objhead {
#define hoh_head _u.n.u_n_hoh_head #define hoh_head _u.n.u_n_hoh_head
}; };
void HSH_DeleteObjHead(struct worker *w, struct objhead *oh); void HSH_DeleteObjHead(struct dstat *, struct objhead *oh);
int HSH_Deref(struct worker *w, struct objcore *oc, struct object **o); int HSH_Deref(struct dstat *, struct objcore *oc, struct object **o);
#endif /* VARNISH_CACHE_CHILD */ #endif /* VARNISH_CACHE_CHILD */
extern const struct hash_slinger hsl_slinger; extern const struct hash_slinger hsl_slinger;
......
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