]> granicus.if.org Git - zfs/commitdiff
Add MUTEX_NOT_HELD() function
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 27 Aug 2010 20:36:24 +0000 (13:36 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 27 Aug 2010 21:23:48 +0000 (14:23 -0700)
Simply implement the missing MUTEX_NOT_HELD() function using
the !MUTEX_HELD construct.

include/sys/mutex.h

index ce8c0f4e91fbbce62442e213468fea67b3564f15..97f49cb2acd2cfae2e4af563dc43cd8aab97056a 100644 (file)
@@ -57,7 +57,8 @@ mutex_owned(kmutex_t *mp)
        return (ACCESS_ONCE(mp->owner) == current_thread_info());
 }
 
-#define MUTEX_HELD(mp)                  mutex_owned(mp)
+#define MUTEX_HELD(mp)          mutex_owned(mp)
+#define MUTEX_NOT_HELD(mp)      (!MUTEX_HELD(mp))
 #undef mutex_init
 #define mutex_init(mp, name, type, ibc)                                 \
 ({                                                                      \
@@ -150,6 +151,7 @@ mutex_owner(kmutex_t *mp)
 
 #define mutex_owned(mp)         (mutex_owner(mp) == current)
 #define MUTEX_HELD(mp)          mutex_owned(mp)
+#define MUTEX_NOT_HELD(mp)      (!MUTEX_HELD(mp))
 
 /*
  * The following functions must be a #define and not static inline.