[master] 5020806 Make VBF_Fetch() take an objcore* to the ims-candidate.

Poul-Henning Kamp phk at FreeBSD.org
Wed Jul 30 10:31:03 CEST 2014


commit 5020806aec860bfe608c8f520643104f5768bbcf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jul 30 08:30:05 2014 +0000

    Make VBF_Fetch() take an objcore* to the ims-candidate.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index ceaf2e6..1e5cc3e 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -898,7 +898,7 @@ enum vbf_fetch_mode_e {
 	VBF_BACKGROUND = 2,
 };
 void VBF_Fetch(struct worker *wrk, struct req *req,
-    struct objcore *oc, struct object *oldobj, enum vbf_fetch_mode_e);
+    struct objcore *oc, struct objcore *oldoc, enum vbf_fetch_mode_e);
 
 /* cache_fetch_proc.c */
 struct storage *VFP_GetStorage(struct vfp_ctx *, ssize_t sz);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index e0320fc..4f6d78a 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -852,17 +852,21 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 
 void
 VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
-    struct object *oldobj, enum vbf_fetch_mode_e mode)
+    struct objcore *oldoc, enum vbf_fetch_mode_e mode)
 {
 	struct busyobj *bo;
 	const char *how;
+	struct object *oldobj = NULL;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
-	CHECK_OBJ_ORNULL(oldobj, OBJECT_MAGIC);
+	CHECK_OBJ_ORNULL(oldoc, OBJCORE_MAGIC);
 
 
+	if (oldoc != NULL)
+		oldobj = ObjGetObj(oldoc, &wrk->stats);
+
 	switch(mode) {
 	case VBF_PASS:		how = "pass"; break;
 	case VBF_NORMAL:	how = "fetch"; break;
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 9cb5c34..3e17779 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -426,7 +426,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
 			AZ(oc->flags & (OC_F_FAILED|OC_F_PASS));
 			AZ(oc->exp_flags & OC_EF_DYING);
 			AZ(boc->busyobj);
-			VBF_Fetch(wrk, req, boc, o, VBF_BACKGROUND);
+			VBF_Fetch(wrk, req, boc, oc, VBF_BACKGROUND);
 		} else {
 			(void)HTTP1_DiscardReqBody(req);// XXX: handle err
 		}
@@ -506,7 +506,7 @@ cnt_miss(struct worker *wrk, struct req *req)
 	switch (wrk->handling) {
 	case VCL_RET_FETCH:
 		wrk->stats.cache_miss++;
-		VBF_Fetch(wrk, req, req->objcore, o, VBF_NORMAL);
+		VBF_Fetch(wrk, req, req->objcore, o == NULL ? NULL : o->objcore, VBF_NORMAL);
 		req->req_step = R_STP_FETCH;
 		if (o != NULL)
 			(void)HSH_DerefObj(&wrk->stats, &o);



More information about the varnish-commit mailing list