[master] 1a30dde Give the persistent watcher-thread something to do
Poul-Henning Kamp
phk at varnish-cache.org
Wed Feb 9 16:07:15 CET 2011
commit 1a30dde3bb72c9dc4b35766fe7a61197954e539b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Feb 9 15:06:27 2011 +0000
Give the persistent watcher-thread something to do
diff --git a/bin/varnishd/storage_persistent.c b/bin/varnishd/storage_persistent.c
index fa32472..0fd2ee4 100644
--- a/bin/varnishd/storage_persistent.c
+++ b/bin/varnishd/storage_persistent.c
@@ -309,8 +309,16 @@ smp_thread(struct sess *sp, void *priv)
BAN_Deref(&sc->tailban);
sc->tailban = NULL;
printf("Silo completely loaded\n");
- while (1)
+ while (1) {
(void)sleep (1);
+ sg = VTAILQ_FIRST(&sc->segments);
+ if (sg != NULL && sg -> sc->cur_seg &&
+ sg->nobj == 0) {
+ Lck_Lock(&sc->mtx);
+ smp_save_segs(sc);
+ Lck_Unlock(&sc->mtx);
+ }
+ }
NEEDLESS_RETURN(NULL);
}
diff --git a/bin/varnishd/storage_persistent.h b/bin/varnishd/storage_persistent.h
index 35affb6..bf4e2b5 100644
--- a/bin/varnishd/storage_persistent.h
+++ b/bin/varnishd/storage_persistent.h
@@ -185,6 +185,7 @@ void smp_load_seg(const struct sess *sp, const struct smp_sc *sc,
void smp_new_seg(struct smp_sc *sc);
void smp_close_seg(struct smp_sc *sc, struct smp_seg *sg);
void smp_init_oc(struct objcore *oc, struct smp_seg *sg, unsigned objidx);
+void smp_save_segs(struct smp_sc *sc);
/* storage_persistent_subr.c */
diff --git a/bin/varnishd/storage_persistent_silo.c b/bin/varnishd/storage_persistent_silo.c
index d312ec9..7a8bac2 100644
--- a/bin/varnishd/storage_persistent_silo.c
+++ b/bin/varnishd/storage_persistent_silo.c
@@ -83,7 +83,7 @@ smp_save_seg(const struct smp_sc *sc, struct smp_signctx *ctx)
smp_sync_sign(ctx);
}
-static void
+void
smp_save_segs(struct smp_sc *sc)
{
struct smp_seg *sg, *sg2;
More information about the varnish-commit
mailing list