[4.1] f4f0fa3 Make the sma and smf locks dynamic.

Lasse Karstensen lkarsten at varnish-software.com
Thu Jan 14 15:15:09 CET 2016


commit f4f0fa33d9adbd7124b3082f991907db1df7c332
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Dec 17 10:48:24 2015 +0000

    Make the sma and smf locks dynamic.
    
    Conflicts:
    	include/tbl/locks.h
    
    Merge note: Keeping persistence locks are they were, due to non-merged SML reorganisation.

diff --git a/bin/varnishd/storage/storage_file.c b/bin/varnishd/storage/storage_file.c
index 151f75e..152d3b2 100644
--- a/bin/varnishd/storage/storage_file.c
+++ b/bin/varnishd/storage/storage_file.c
@@ -62,6 +62,8 @@
  */
 #define NBUCKET			(128 / 4 + 1)
 
+static struct VSC_C_lck *lck_smf;
+
 /*--------------------------------------------------------------------*/
 
 VTAILQ_HEAD(smfhead, smf);
@@ -419,6 +421,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 ce6b0c2..87b634f 100644
--- a/bin/varnishd/storage/storage_malloc.c
+++ b/bin/varnishd/storage/storage_malloc.c
@@ -56,6 +56,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)
 {
@@ -234,6 +236,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 4a1539e..7b4b171 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(smp)
 LOCK(vbe)
 LOCK(vcapace)



More information about the varnish-commit mailing list