[master] 5060748 Make the sma and smf locks dynamic.
Poul-Henning Kamp
phk at FreeBSD.org
Thu Dec 17 11:48:38 CET 2015
commit 506074885f5acfa4f3f151814729d32f11f8214a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Dec 17 10:48:24 2015 +0000
Make the sma and smf locks dynamic.
diff --git a/bin/varnishd/storage/storage_file.c b/bin/varnishd/storage/storage_file.c
index c1d7992..9df6d9f 100644
--- a/bin/varnishd/storage/storage_file.c
+++ b/bin/varnishd/storage/storage_file.c
@@ -63,6 +63,8 @@
*/
#define NBUCKET (128 / 4 + 1)
+static struct VSC_C_lck *lck_smf;
+
/*--------------------------------------------------------------------*/
VTAILQ_HEAD(smfhead, smf);
@@ -420,6 +422,9 @@ smf_open(const struct stevedore *st)
off_t fail = 1 << 30; /* XXX: where is OFF_T_MAX ? */
off_t sum = 0;
+ ASSERT_CLI();
+ if (lck_smf == NULL)
+ lck_smf = Lck_CreateClass("smf");
CAST_OBJ_NOTNULL(sc, st->priv, SMF_SC_MAGIC);
sc->stats = VSM_Alloc(sizeof *sc->stats,
VSC_CLASS, VSC_type_smf, st->ident);
diff --git a/bin/varnishd/storage/storage_malloc.c b/bin/varnishd/storage/storage_malloc.c
index d7d4561..8f085f7 100644
--- a/bin/varnishd/storage/storage_malloc.c
+++ b/bin/varnishd/storage/storage_malloc.c
@@ -57,6 +57,8 @@ struct sma {
struct sma_sc *sc;
};
+static struct VSC_C_lck *lck_sma;
+
static struct storage *
sma_alloc(const struct stevedore *st, size_t size)
{
@@ -235,6 +237,9 @@ sma_open(const struct stevedore *st)
{
struct sma_sc *sma_sc;
+ ASSERT_CLI();
+ if (lck_sma == NULL)
+ lck_sma = Lck_CreateClass("sma");
CAST_OBJ_NOTNULL(sma_sc, st->priv, SMA_SC_MAGIC);
Lck_New(&sma_sc->sma_mtx, lck_sma);
sma_sc->stats = VSM_Alloc(sizeof *sma_sc->stats,
diff --git a/include/tbl/locks.h b/include/tbl/locks.h
index 25502e1..8d99eb7 100644
--- a/include/tbl/locks.h
+++ b/include/tbl/locks.h
@@ -40,8 +40,6 @@ LOCK(mempool)
LOCK(objhdr)
LOCK(pipestat)
LOCK(sess)
-LOCK(sma)
-LOCK(smf)
LOCK(vbe)
LOCK(vcapace)
LOCK(vcl)
More information about the varnish-commit
mailing list