[master] 149e627 Put stats directly in vfp_ctx
Poul-Henning Kamp
phk at FreeBSD.org
Tue Aug 19 09:17:02 CEST 2014
commit 149e6277af1bc5d43d69b3caad336882298c2f69
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Aug 19 07:14:55 2014 +0000
Put stats directly in vfp_ctx
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index cdfbcee..854cf8b 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -455,6 +455,7 @@ struct vfp_ctx {
unsigned magic;
#define VFP_CTX_MAGIC 0x61d9d3e5
struct busyobj *bo;
+ struct dstat *stats;
int failed;
@@ -894,7 +895,7 @@ void EXP_Init(void);
void EXP_Rearm(struct objcore *, double now, double ttl, double grace,
double keep);
void EXP_Touch(struct objcore *oc, double now);
-int EXP_NukeOne(struct busyobj *, struct lru *lru);
+int EXP_NukeOne(struct vsl_log *vsl, struct dstat *ds, struct lru *lru);
/* cache_fetch.c */
enum vbf_fetch_mode_e {
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 5c59185..1cc223b 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -286,17 +286,20 @@ EXP_Rearm(struct objcore *oc, double now, double ttl, double grace, double keep)
*/
int
-EXP_NukeOne(struct busyobj *bo, struct lru *lru)
+EXP_NukeOne(struct vsl_log *vsl, struct dstat *ds, struct lru *lru)
{
struct objcore *oc, *oc2;
struct objhead *oh;
+ AN(vsl);
+ AN(ds);
+ CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
/* Find the first currently unused object on the LRU. */
Lck_Lock(&lru->mtx);
VTAILQ_FOREACH_SAFE(oc, &lru->lru_head, lru_list, oc2) {
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
- VSLb(bo->vsl, SLT_ExpKill, "LRU_Cand p=%p f=0x%x r=%d",
+ VSLb(vsl, SLT_ExpKill, "LRU_Cand p=%p f=0x%x r=%d",
oc, oc->flags, oc->refcnt);
AZ(oc->exp_flags & OC_EF_OFFLRU);
@@ -328,19 +331,17 @@ EXP_NukeOne(struct busyobj *bo, struct lru *lru)
Lck_Unlock(&lru->mtx);
if (oc == NULL) {
- VSLb(bo->vsl, SLT_ExpKill, "LRU_Fail");
+ VSLb(vsl, SLT_ExpKill, "LRU_Fail");
return (-1);
}
/* XXX: We could grab and return one storage segment to our caller */
- ObjSlim(oc, bo->stats);
+ ObjSlim(oc, ds);
exp_mail_it(oc);
- VSLb(bo->vsl, SLT_ExpKill, "LRU x=%u", ObjGetXID(oc, bo->stats));
- AN(bo->stats);
- AN(oc);
- (void)HSH_DerefObjCore(bo->stats, &oc);
+ VSLb(vsl, SLT_ExpKill, "LRU x=%u", ObjGetXID(oc, ds));
+ (void)HSH_DerefObjCore(ds, &oc);
return (1);
}
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 2c08ccd..f389304 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -364,6 +364,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
VFP_Setup(bo->vfc);
bo->vfc->bo = bo;
+ bo->vfc->stats = bo->stats;
bo->vfc->http = bo->beresp;
bo->vfc->vsl = bo->vsl;
@@ -684,6 +685,7 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
VFP_Setup(bo->vfc);
bo->vfc->bo = bo;
+ bo->vfc->stats = bo->stats;
bo->vfc->http = bo->beresp;
bo->vfc->vsl = bo->vsl;
diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index fd83152..43d89ef 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -86,7 +86,7 @@ VFP_GetStorage(struct vfp_ctx *vc, ssize_t sz)
if (st != NULL && st->len < st->space)
return (st);
- AN(vc->bo->stats);
+ AN(vc->stats);
l = fetchfrag;
if (l == 0)
l = sz;
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 93cba08..b9984d7 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -299,7 +299,7 @@ ObjSetattr(const struct vfp_ctx *vc, enum obj_attr attr, ssize_t len,
CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vc->bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(vc->bo->fetch_objcore, OBJCORE_MAGIC);
- o = obj_getobj(vc->bo->fetch_objcore, vc->bo->stats);
+ o = obj_getobj(vc->bo->fetch_objcore, vc->stats);
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
switch (attr) {
case OA_ESIDATA:
@@ -347,7 +347,7 @@ ObjCopyAttr(const struct vfp_ctx *vc, struct objcore *ocs, enum obj_attr attr)
CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
- vps = ObjGetattr(ocs, vc->bo->stats, attr, &l);
+ vps = ObjGetattr(ocs, vc->stats, attr, &l);
// XXX: later we want to have zero-length OA's too
if (vps == NULL || l <= 0)
return (-1);
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index d11f306..39fddd9 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -195,7 +195,6 @@ stv_alloc_obj(const struct vfp_ctx *vc, size_t size)
*/
CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vc->bo, BUSYOBJ_MAGIC);
- AN(vc->bo->stats);
stv = vc->body->stevedore;
CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC);
@@ -213,7 +212,7 @@ stv_alloc_obj(const struct vfp_ctx *vc, size_t size)
/* no luck; try to free some space and keep trying */
if (fail < cache_param->nuke_limit &&
- EXP_NukeOne(vc->bo, stv->lru) == -1)
+ EXP_NukeOne(vc->vsl, vc->stats, stv->lru) == -1)
break;
}
CHECK_OBJ_ORNULL(st, STORAGE_MAGIC);
@@ -349,7 +348,7 @@ STV_NewObject(struct busyobj *bo, const char *hint, unsigned wsl)
if (o == NULL) {
/* no luck; try to free some space and keep trying */
for (i = 0; o == NULL && i < cache_param->nuke_limit; i++) {
- if (EXP_NukeOne(bo, stv->lru) == -1)
+ if (EXP_NukeOne(bo->vsl, bo->stats, stv->lru) == -1)
break;
o = stv->allocobj(stv, bo, ltot, &soc);
}
More information about the varnish-commit
mailing list