[experimental-ims] 7703a5f Lend busyobj the workers dstat for the duration of Fetch_Body()

Geoff Simmons geoff at varnish-cache.org
Fri Feb 17 13:58:53 CET 2012


commit 7703a5f82679f56e82cdff7a6f98dfb27dbdae31
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 15 12:32:28 2012 +0000

    Lend busyobj the workers dstat for the duration of Fetch_Body()

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index a9051bc..f2f64d3 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -494,6 +494,7 @@ struct busyobj {
 	double			between_bytes_timeout;
 
 	struct vsl_log		vsl[1];
+	struct dstat		*stats;
 };
 
 /* Object structure --------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index cd01b59..928ecc4 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -506,6 +506,13 @@ FetchBody(struct worker *wrk, struct object *obj)
 	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
 	CHECK_OBJ_NOTNULL(obj->http, HTTP_MAGIC);
 
+	/*
+ 	 * XXX: The busyobj needs a dstat, but it is not obvious which one
+	 * XXX: it should be (own/borrowed).  For now borrow the wrk's.
+	 */
+	AZ(bo->stats);
+	bo->stats = &wrk->stats;
+
 	htc = &bo->htc;
 
 	if (bo->vfp == NULL)
@@ -578,6 +585,7 @@ FetchBody(struct worker *wrk, struct object *obj)
 
 	if (bo->body_status == BS_ERROR) {
 		VDI_CloseFd(wrk, &bo->vbc);
+		bo->stats = NULL;
 		return (__LINE__);
 	}
 
@@ -585,6 +593,7 @@ FetchBody(struct worker *wrk, struct object *obj)
 		wrk->stats.fetch_failed++;
 		VDI_CloseFd(wrk, &bo->vbc);
 		obj->len = 0;
+		bo->stats = NULL;
 		return (__LINE__);
 	}
 	AZ(bo->fetch_failed);
@@ -619,6 +628,7 @@ FetchBody(struct worker *wrk, struct object *obj)
 	else
 		VDI_RecycleFd(wrk, &bo->vbc);
 
+	bo->stats = NULL;
 	return (0);
 }
 



More information about the varnish-commit mailing list