[master] 02fd3c7 Implement a getxid method that doesn't require full resurrection of zombie objects.
Poul-Henning Kamp
phk at varnish-cache.org
Tue Dec 6 12:04:27 CET 2011
commit 02fd3c797265b7edbd7e5a7759b431cfd5afa91d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Dec 6 11:03:36 2011 +0000
Implement a getxid method that doesn't require full resurrection
of zombie objects.
diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c
index b7ef952..7cafe4f 100644
--- a/bin/varnishd/storage/storage_persistent_silo.c
+++ b/bin/varnishd/storage/storage_persistent_silo.c
@@ -369,6 +369,35 @@ smp_loaded_st(const struct smp_sc *sc, const struct smp_seg *sg,
* objcore methods for persistent objects
*/
+static unsigned __match_proto__(getxid_f)
+smp_oc_getxid(struct worker *wrk, struct objcore *oc)
+{
+ struct object *o;
+ struct smp_seg *sg;
+ struct smp_object *so;
+
+ (void)wrk;
+ CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
+
+ CAST_OBJ_NOTNULL(sg, oc->priv, SMP_SEG_MAGIC);
+ so = smp_find_so(sg, oc->priv2);
+
+ o = (void*)(sg->sc->base + so->ptr);
+ /*
+ * The object may not be in this segment since we allocate it
+ * In a separate operation than the smp_object. We could check
+ * that it is in a later segment, but that would be complicated.
+ * XXX: For now, be happy if it is inside th silo
+ */
+ ASSERT_PTR_IN_SILO(sg->sc, o);
+ CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+ return (o->xid);
+}
+
+/*---------------------------------------------------------------------
+ * objcore methods for persistent objects
+ */
+
static struct object *
smp_oc_getobj(struct worker *wrk, struct objcore *oc)
{
@@ -506,6 +535,7 @@ smp_oc_getlru(const struct objcore *oc)
}
static struct objcore_methods smp_oc_methods = {
+ .getxid = smp_oc_getxid,
.getobj = smp_oc_getobj,
.updatemeta = smp_oc_updatemeta,
.freeobj = smp_oc_freeobj,
More information about the varnish-commit
mailing list