]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Use MUTEX_FSTRANS mutex type
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 26 Feb 2015 23:29:33 +0000 (15:29 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 3 Mar 2015 18:46:40 +0000 (10:46 -0800)
There are regions in the ZFS code where it is desirable to be able
to be set PF_FSTRANS while a specific mutex is held.  The ZFS code
could be updated to set/clear this flag in all the correct places,
but this is undesirable for a few reasons.

1) It would require changes to a significant amount of the ZFS
   code.  This would complicate applying patches from upstream.

2) It would be easy to accidentally miss a critical region in
   the initial patch or to have an future change introduce a
   new one.

Both of these concerns can be addressed by using a new mutex type
which is responsible for managing PF_FSTRANS, support for which was
added to the SPL in commit zfsonlinux/spl@9099312 - Merge branch
'kmem-rework'.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes #3050
Closes #3055
Closes #3062
Closes #3132
Closes #3142
Closes #2983

include/sys/zfs_context.h
module/zfs/arc.c
module/zfs/dbuf.c

index 3dc54f1d7d90ada20e94bc001acd9427b1c794ae..b8eff58bc6157a21b530f250525aa897e1e29ce8 100644 (file)
@@ -273,6 +273,7 @@ typedef struct kmutex {
 } kmutex_t;
 
 #define        MUTEX_DEFAULT   0
+#define        MUTEX_FSTRANS   MUTEX_DEFAULT
 #define        MUTEX_HELD(m)   ((m)->m_owner == curthread)
 #define        MUTEX_NOT_HELD(m) (!MUTEX_HELD(m))
 
index 800394c216534bdc4cffbf10790b05b6f4ec6bec..070d85aafed68ab08dabee6b9f6f474f6525e93a 100644 (file)
@@ -928,7 +928,7 @@ retry:
 
        for (i = 0; i < BUF_LOCKS; i++) {
                mutex_init(&buf_hash_table.ht_locks[i].ht_lock,
-                   NULL, MUTEX_DEFAULT, NULL);
+                   NULL, MUTEX_FSTRANS, NULL);
        }
 }
 
index 9be69b5ae2cfe6e40fbd070ffff971913a6497df..277e5439e3df657ec0b35887235f770035165904 100644 (file)
@@ -331,7 +331,7 @@ retry:
            0, dbuf_cons, dbuf_dest, NULL, NULL, NULL, 0);
 
        for (i = 0; i < DBUF_MUTEXES; i++)
-               mutex_init(&h->hash_mutexes[i], NULL, MUTEX_DEFAULT, NULL);
+               mutex_init(&h->hash_mutexes[i], NULL, MUTEX_FSTRANS, NULL);
 
        dbuf_stats_init(h);
 }