aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rwsem_compat.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2016-07-26 23:37:46 +0000
committerBrian Behlendorf <[email protected]>2016-07-29 14:17:53 -0700
commitb7c7008ba28ca926fbda929aec52f3761d72cffe (patch)
tree21c4186bf940b6ed92a72960559bac0e4be31f90 /include/linux/rwsem_compat.h
parentd2f97b2a2651d8e1a6e9e1dcb07cfe8570efcfff (diff)
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 <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #563
Diffstat (limited to 'include/linux/rwsem_compat.h')
-rw-r--r--include/linux/rwsem_compat.h7
1 files changed, 5 insertions, 2 deletions
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