[master] fe8ec80 Argument strength-reduction: from worker to dstats
Poul-Henning Kamp
phk at varnish-cache.org
Tue Feb 14 12:19:39 CET 2012
commit fe8ec801f6ed776522df03c7ff271406b76bc298
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Feb 14 11:19:22 2012 +0000
Argument strength-reduction: from worker to dstats
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 6dc3618..b02e5f9 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -908,7 +908,7 @@ ban_lurker_work(const struct sess *sp, unsigned pass)
if (cache_param->diag_bitmap & 0x80000)
VSL(SLT_Debug, 0, "lurker done: %p %u %u",
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);
}
Lck_AssertHeld(&ban_mtx);
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 57e5616..61d1a94 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -289,7 +289,7 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
HSH_Drop(wrk);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
} else {
- (void)HSH_Deref(wrk, NULL, &req->obj);
+ (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
}
AZ(req->obj);
req->restarts++;
@@ -338,7 +338,7 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req)
RES_WriteObj(sp);
assert(WRW_IsReleased(wrk));
- (void)HSH_Deref(wrk, NULL, &req->obj);
+ (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
http_Teardown(req->resp);
sp->step = STP_DONE;
return (0);
@@ -641,7 +641,7 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
if (req->objcore != NULL) {
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;
}
VBO_DerefBusyObj(wrk, &wrk->busyobj);
@@ -972,7 +972,7 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
RES_StreamEnd(sp);
assert(WRW_IsReleased(wrk));
- (void)HSH_Deref(wrk, NULL, &req->obj);
+ (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
http_Teardown(req->resp);
sp->step = STP_DONE;
@@ -1065,7 +1065,7 @@ cnt_hit(struct sess *sp, struct worker *wrk, struct req *req)
}
/* 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;
switch(req->handling) {
@@ -1183,7 +1183,7 @@ cnt_lookup(struct sess *sp, struct worker *wrk, struct req *req)
if (oc->flags & OC_F_PASS) {
wrk->stats.cache_hitpass++;
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);
sp->step = STP_PASS;
return (0);
@@ -1242,7 +1242,7 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req)
return (0);
}
- AZ(HSH_Deref(wrk, req->objcore, NULL));
+ AZ(HSH_Deref(&wrk->stats, req->objcore, NULL));
req->objcore = NULL;
http_Teardown(wrk->busyobj->bereq);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 1060bac..840e0b7 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -402,7 +402,7 @@ exp_timer(struct sess *sp, void *priv)
o = oc_getobj(sp->wrk, oc);
WSL(sp->wrk->vsl, SLT_ExpKill, 0, "%u %.0f",
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);
}
@@ -446,7 +446,7 @@ EXP_NukeOne(struct worker *wrk, struct lru *lru)
/* XXX: bad idea for -spersistent */
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);
}
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 49f6d30..eebb999 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -139,13 +139,13 @@ HSH_Cleanup(struct worker *wrk)
}
void
-HSH_DeleteObjHead(struct worker *wrk, struct objhead *oh)
+HSH_DeleteObjHead(struct dstat *ds, struct objhead *oh)
{
AZ(oh->refcnt);
assert(VTAILQ_EMPTY(&oh->objcs));
Lck_Delete(&oh->mtx);
- wrk->stats.n_objecthead--;
+ ds->n_objecthead--;
FREE_OBJ(oh);
}
@@ -564,7 +564,7 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace)
o->exp.ttl = ttl;
o->exp.grace = grace;
EXP_Rearm(o);
- (void)HSH_Deref(sp->wrk, NULL, &o);
+ (void)HSH_Deref(&sp->wrk->stats, NULL, &o);
}
WS_Release(sp->req->ws, 0);
}
@@ -588,7 +588,7 @@ HSH_Drop(struct worker *wrk)
o->exp.ttl = -1.;
if (o->objcore != NULL) /* Pass has no objcore */
HSH_Unbusy(wrk);
- (void)HSH_Deref(wrk, NULL, &wrk->sp->req->obj);
+ (void)HSH_Deref(&wrk->stats, NULL, &wrk->sp->req->obj);
}
void
@@ -660,7 +660,7 @@ HSH_Ref(struct objcore *oc)
*/
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 objhead *oh;
@@ -683,7 +683,7 @@ HSH_Deref(struct worker *wrk, struct objcore *oc, struct object **oo)
*/
STV_Freestore(o);
STV_free(o->objstore);
- wrk->stats.n_object--;
+ ds->n_object--;
return (0);
}
@@ -713,16 +713,16 @@ HSH_Deref(struct worker *wrk, struct objcore *oc, struct object **oo)
if (oc->methods != NULL) {
oc_freeobj(oc);
- wrk->stats.n_object--;
+ ds->n_object--;
}
FREE_OBJ(oc);
- wrk->stats.n_objectcore--;
+ ds->n_objectcore--;
/* Drop our ref on the objhead */
assert(oh->refcnt > 0);
if (hash->deref(oh))
return (0);
- HSH_DeleteObjHead(wrk, oh);
+ HSH_DeleteObjHead(ds, oh);
return (0);
}
diff --git a/bin/varnishd/hash/hash_critbit.c b/bin/varnishd/hash/hash_critbit.c
index 5fafac5..069a1c2 100644
--- a/bin/varnishd/hash/hash_critbit.c
+++ b/bin/varnishd/hash/hash_critbit.c
@@ -359,7 +359,7 @@ hcb_cleaner(struct sess *sp, void *priv)
}
VTAILQ_FOREACH_SAFE(oh, &dead_h, hoh_list, oh2) {
VTAILQ_REMOVE(&dead_h, oh, hoh_list);
- HSH_DeleteObjHead(wrk, oh);
+ HSH_DeleteObjHead(&wrk->stats, oh);
}
Lck_Lock(&hcb_mtx);
VSTAILQ_CONCAT(&dead_y, &cool_y);
diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h
index b45e604..1bc08b1 100644
--- a/bin/varnishd/hash/hash_slinger.h
+++ b/bin/varnishd/hash/hash_slinger.h
@@ -95,8 +95,8 @@ struct objhead {
#define hoh_head _u.n.u_n_hoh_head
};
-void HSH_DeleteObjHead(struct worker *w, struct objhead *oh);
-int HSH_Deref(struct worker *w, struct objcore *oc, struct object **o);
+void HSH_DeleteObjHead(struct dstat *, struct objhead *oh);
+int HSH_Deref(struct dstat *, struct objcore *oc, struct object **o);
#endif /* VARNISH_CACHE_CHILD */
extern const struct hash_slinger hsl_slinger;
More information about the varnish-commit
mailing list