diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cddl/compat/opensolaris/sys/mutex.h | 8 | ||||
-rw-r--r-- | sys/cddl/compat/opensolaris/sys/rwlock.h | 8 | ||||
-rw-r--r-- | sys/compat/opensolaris/sys/mutex.h | 8 | ||||
-rw-r--r-- | sys/compat/opensolaris/sys/rwlock.h | 8 |
4 files changed, 28 insertions, 4 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/mutex.h b/sys/cddl/compat/opensolaris/sys/mutex.h index dac7249..d7543af 100644 --- a/sys/cddl/compat/opensolaris/sys/mutex.h +++ b/sys/cddl/compat/opensolaris/sys/mutex.h @@ -46,12 +46,18 @@ typedef enum { typedef struct sx kmutex_t; +#ifndef DEBUG +#define MUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS) +#else +#define MUTEX_FLAGS (SX_DUPOK) +#endif + #define mutex_init(lock, desc, type, arg) do { \ ASSERT((type) == MUTEX_DEFAULT); \ KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \ LO_EXPECTED, ("lock %s already initialized", #lock)); \ bzero((lock), sizeof(struct sx)); \ - sx_init_flags((lock), "zfs:" #lock, SX_DUPOK); \ + sx_init_flags((lock), "zfs:" #lock, MUTEX_FLAGS); \ } while (0) #define mutex_destroy(lock) sx_destroy(lock) #define mutex_enter(lock) sx_xlock(lock) diff --git a/sys/cddl/compat/opensolaris/sys/rwlock.h b/sys/cddl/compat/opensolaris/sys/rwlock.h index 6facd7a..e877175 100644 --- a/sys/cddl/compat/opensolaris/sys/rwlock.h +++ b/sys/cddl/compat/opensolaris/sys/rwlock.h @@ -48,6 +48,12 @@ typedef enum { typedef struct sx krwlock_t; +#ifndef DEBUG +#define RW_FLAGS (SX_DUPOK | SX_NOWITNESS) +#else +#define RW_FLAGS (SX_DUPOK) +#endif + #define RW_READ_HELD(x) (rw_read_held((x))) #define RW_WRITE_HELD(x) (rw_write_held((x))) #define RW_LOCK_HELD(x) (rw_lock_held((x))) @@ -57,7 +63,7 @@ typedef struct sx krwlock_t; KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \ LO_EXPECTED, ("lock %s already initialized", #lock)); \ bzero((lock), sizeof(struct sx)); \ - sx_init_flags((lock), "zfs:" #lock, SX_DUPOK); \ + sx_init_flags((lock), "zfs:" #lock, RW_FLAGS); \ } while (0) #define rw_destroy(lock) sx_destroy(lock) #define rw_enter(lock, how) do { \ diff --git a/sys/compat/opensolaris/sys/mutex.h b/sys/compat/opensolaris/sys/mutex.h index dac7249..d7543af 100644 --- a/sys/compat/opensolaris/sys/mutex.h +++ b/sys/compat/opensolaris/sys/mutex.h @@ -46,12 +46,18 @@ typedef enum { typedef struct sx kmutex_t; +#ifndef DEBUG +#define MUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS) +#else +#define MUTEX_FLAGS (SX_DUPOK) +#endif + #define mutex_init(lock, desc, type, arg) do { \ ASSERT((type) == MUTEX_DEFAULT); \ KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \ LO_EXPECTED, ("lock %s already initialized", #lock)); \ bzero((lock), sizeof(struct sx)); \ - sx_init_flags((lock), "zfs:" #lock, SX_DUPOK); \ + sx_init_flags((lock), "zfs:" #lock, MUTEX_FLAGS); \ } while (0) #define mutex_destroy(lock) sx_destroy(lock) #define mutex_enter(lock) sx_xlock(lock) diff --git a/sys/compat/opensolaris/sys/rwlock.h b/sys/compat/opensolaris/sys/rwlock.h index 6facd7a..e877175 100644 --- a/sys/compat/opensolaris/sys/rwlock.h +++ b/sys/compat/opensolaris/sys/rwlock.h @@ -48,6 +48,12 @@ typedef enum { typedef struct sx krwlock_t; +#ifndef DEBUG +#define RW_FLAGS (SX_DUPOK | SX_NOWITNESS) +#else +#define RW_FLAGS (SX_DUPOK) +#endif + #define RW_READ_HELD(x) (rw_read_held((x))) #define RW_WRITE_HELD(x) (rw_write_held((x))) #define RW_LOCK_HELD(x) (rw_lock_held((x))) @@ -57,7 +63,7 @@ typedef struct sx krwlock_t; KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \ LO_EXPECTED, ("lock %s already initialized", #lock)); \ bzero((lock), sizeof(struct sx)); \ - sx_init_flags((lock), "zfs:" #lock, SX_DUPOK); \ + sx_init_flags((lock), "zfs:" #lock, RW_FLAGS); \ } while (0) #define rw_destroy(lock) sx_destroy(lock) #define rw_enter(lock, how) do { \ |