From b7c7008ba28ca926fbda929aec52f3761d72cffe Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 26 Jul 2016 23:37:46 +0000 Subject: Linux 4.8 compat: rw_semaphore atomic_long_t count For non-rwsem-spinlocks the "count" member was changed from a "long" to "atomic_long_t" type. A configure check has been added to detect this change along with new versions of the _rwsem_tryupgrade() function and RWSEM_COUNT() macro. See https://github.com/torvalds/linux/commit/8ee62b18 for complete details. Signed-off-by: Tim Chase Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #563 --- include/linux/rwsem_compat.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include/linux/rwsem_compat.h') diff --git a/include/linux/rwsem_compat.h b/include/linux/rwsem_compat.h index 9a4df2673..c874885b0 100644 --- a/include/linux/rwsem_compat.h +++ b/include/linux/rwsem_compat.h @@ -35,9 +35,12 @@ #define SPL_RWSEM_SINGLE_WRITER_VALUE (RWSEM_ACTIVE_WRITE_BIAS) #endif -/* Linux 3.16 change activity to count for rwsem-spinlock */ -#ifdef HAVE_RWSEM_ACTIVITY +/* Linux 3.16 changed activity to count for rwsem-spinlock */ +#if defined(HAVE_RWSEM_ACTIVITY) #define RWSEM_COUNT(sem) sem->activity +/* Linux 4.8 changed count to an atomic_long_t for !rwsem-spinlock */ +#elif defined(HAVE_RWSEM_ATOMIC_LONG_COUNT) +#define RWSEM_COUNT(sem) atomic_long_read(&(sem)->count) #else #define RWSEM_COUNT(sem) sem->count #endif -- cgit v1.2.3