[master] b98d1b0 Pass the objcore to VBO_waitlen() instead of deriving it from the busyobj

Poul-Henning Kamp phk at FreeBSD.org
Thu Jan 28 12:49:18 CET 2016


commit b98d1b05747efb64954cf0ae79708cb8326d43ae
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 19 09:49:11 2016 +0000

    Pass the objcore to VBO_waitlen() instead of deriving it from the busyobj

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index cdcfc3a..9fdb6f1 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -671,7 +671,8 @@ double BAN_Time(const struct ban *ban);
 struct busyobj *VBO_GetBusyObj(struct worker *, const struct req *);
 void VBO_DerefBusyObj(struct worker *wrk, struct busyobj **busyobj);
 void VBO_extend(struct busyobj *, ssize_t);
-ssize_t VBO_waitlen(struct worker *, struct busyobj *, ssize_t l);
+ssize_t VBO_waitlen(struct worker *, struct objcore *, struct busyobj *,
+    ssize_t l);
 void VBO_setstate(struct busyobj *bo, enum busyobj_state_e next);
 void VBO_waitstate(struct busyobj *bo, enum busyobj_state_e want);
 
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index f32831f..f9c239a 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -236,20 +236,22 @@ VBO_extend(struct busyobj *bo, ssize_t l)
 }
 
 ssize_t
-VBO_waitlen(struct worker *wrk, struct busyobj *bo, ssize_t l)
+VBO_waitlen(struct worker *wrk, struct objcore *oc, struct busyobj *bo,
+    ssize_t l)
 {
 	ssize_t rv;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	xxxassert(bo->fetch_objcore == oc);
 	Lck_Lock(&bo->mtx);
-	rv = ObjGetLen(wrk, bo->fetch_objcore);
+	rv = ObjGetLen(wrk, oc);
 	while (1) {
 		assert(l <= rv || bo->state == BOS_FAILED);
 		if (rv > l || bo->state >= BOS_FINISHED)
 			break;
 		(void)Lck_CondWait(&bo->cond, &bo->mtx, 0);
-		rv = ObjGetLen(wrk, bo->fetch_objcore);
+		rv = ObjGetLen(wrk, oc);
 	}
 	Lck_Unlock(&bo->mtx);
 	return (rv);
diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index afbf6cc..3c253a5 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -257,7 +257,7 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
 
 	while (1) {
 		ol = len;
-		nl = VBO_waitlen(wrk, bo, ol);
+		nl = VBO_waitlen(wrk, oc, bo, ol);
 		if (bo->state == BOS_FAILED) {
 			ret = -1;
 			break;



More information about the varnish-commit mailing list