[master] 817c7be Introduce "ObjStable" callback which informs obj/stevedore that the fetching busyobj is no longer.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Jan 11 11:57:33 CET 2016
commit 817c7be50dc36661ea5002570da3fa001f9efa27
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jan 11 10:52:36 2016 +0000
Introduce "ObjStable" callback which informs obj/stevedore that
the fetching busyobj is no longer.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 1e82ea2..e04b544 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -859,6 +859,7 @@ void *ObjSetattr(struct worker *, struct objcore *, enum obj_attr attr,
ssize_t len, const void *);
int ObjCopyAttr(struct worker *, struct objcore *, struct objcore *,
enum obj_attr attr);
+void ObjStable(struct worker *, struct objcore *, struct busyobj *);
int ObjSetDouble(struct worker *, struct objcore *, enum obj_attr, double);
int ObjSetU32(struct worker *, struct objcore *, enum obj_attr, uint32_t);
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 78e2512..f32831f 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -204,6 +204,8 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
if (bo->fetch_objcore != NULL) {
AN(wrk);
+ if (bo->fetch_objcore->stobj->stevedore != NULL)
+ ObjStable(bo->wrk, bo->fetch_objcore, bo);
(void)HSH_DerefObjCore(wrk, &bo->fetch_objcore);
}
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index ebbb76f..67faea0 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -186,6 +186,22 @@ ObjUpdateMeta(struct worker *wrk, struct objcore *oc)
}
/*====================================================================
+ * Called when the busyobj used to populate the objcore is going away.
+ * Useful for releasing any leftovers from Trim.
+ */
+
+void
+ObjStable(struct worker *wrk, struct objcore *oc, struct busyobj *bo)
+{
+ const struct obj_methods *m = obj_getmethods(oc);
+
+ CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
+ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+ if (m->objstable != NULL)
+ m->objstable(wrk, oc, bo);
+}
+
+/*====================================================================
*/
void
ObjFreeObj(struct worker *wrk, struct objcore *oc)
diff --git a/bin/varnishd/cache/cache_obj.h b/bin/varnishd/cache/cache_obj.h
index c08d75c..0058434 100644
--- a/bin/varnishd/cache/cache_obj.h
+++ b/bin/varnishd/cache/cache_obj.h
@@ -43,6 +43,7 @@ typedef int objgetspace_f(struct worker *, struct objcore *,
ssize_t *sz, uint8_t **ptr);
typedef void objextend_f(struct worker *, struct objcore *, ssize_t l);
typedef void objtrimstore_f(struct worker *, struct objcore *);
+typedef void objstable_f(struct worker *, struct objcore *, struct busyobj *);
typedef void objslim_f(struct worker *, struct objcore *);
typedef void *objgetattr_f(struct worker *, struct objcore *,
enum obj_attr attr, ssize_t *len);
@@ -63,6 +64,7 @@ struct obj_methods {
objextend_f *objextend;
objgetlen_f *objgetlen;
objtrimstore_f *objtrimstore;
+ objstable_f *objstable;
objslim_f *objslim;
objgetattr_f *objgetattr;
objsetattr_f *objsetattr;
More information about the varnish-commit
mailing list