aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/spl/spl-rwlock.c101
1 files changed, 0 insertions, 101 deletions
diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c
index 886e16924..10f7c38db 100644
--- a/module/spl/spl-rwlock.c
+++ b/module/spl/spl-rwlock.c
@@ -24,106 +24,5 @@
* Solaris Porting Layer (SPL) Reader/Writer Lock Implementation.
*/
-#include <sys/rwlock.h>
-#include <linux/module.h>
-
-#if defined(CONFIG_PREEMPT_RT_FULL)
-
-#include <linux/rtmutex.h>
-#define RT_MUTEX_OWNER_MASKALL 1UL
-
-static int
-__rwsem_tryupgrade(struct rw_semaphore *rwsem)
-{
-#if defined(READER_BIAS) && defined(WRITER_BIAS)
- /*
- * After the 4.9.20-rt16 kernel the realtime patch series lifted the
- * single reader restriction. While this could be accommodated by
- * adding additional compatibility code assume the rwsem can never
- * be upgraded. All caller must already cleanly handle this case.
- */
- return (0);
-#else
- ASSERT((struct task_struct *)
- ((unsigned long)rwsem->lock.owner & ~RT_MUTEX_OWNER_MASKALL) ==
- current);
-
- /*
- * Prior to 4.9.20-rt16 kernel the realtime patch series, rwsem is
- * implemented as a single mutex held by readers and writers alike.
- * However, this implementation would prevent a thread from taking
- * a read lock twice, as the mutex would already be locked on
- * the second attempt. Therefore the implementation allows a
- * single thread to take a rwsem as read lock multiple times
- * tracking that nesting as read_depth counter.
- */
- if (rwsem->read_depth <= 1) {
- /*
- * In case, the current thread has not taken the lock
- * more than once as read lock, we can allow an
- * upgrade to a write lock. rwsem_rt.h implements
- * write locks as read_depth == 0.
- */
- rwsem->read_depth = 0;
- return (1);
- }
- return (0);
-#endif
-}
-#elif defined(CONFIG_RWSEM_GENERIC_SPINLOCK)
-static int
-__rwsem_tryupgrade(struct rw_semaphore *rwsem)
-{
- int ret = 0;
- unsigned long flags;
- spl_rwsem_lock_irqsave(&rwsem->wait_lock, flags);
- if (RWSEM_COUNT(rwsem) == SPL_RWSEM_SINGLE_READER_VALUE &&
- list_empty(&rwsem->wait_list)) {
- ret = 1;
- RWSEM_COUNT(rwsem) = SPL_RWSEM_SINGLE_WRITER_VALUE;
- }
- spl_rwsem_unlock_irqrestore(&rwsem->wait_lock, flags);
- return (ret);
-}
-#elif defined(RWSEM_ACTIVE_MASK)
-#if defined(HAVE_RWSEM_ATOMIC_LONG_COUNT)
-static int
-__rwsem_tryupgrade(struct rw_semaphore *rwsem)
-{
- long val;
- val = atomic_long_cmpxchg(&rwsem->count, SPL_RWSEM_SINGLE_READER_VALUE,
- SPL_RWSEM_SINGLE_WRITER_VALUE);
- return (val == SPL_RWSEM_SINGLE_READER_VALUE);
-}
-#else
-static int
-__rwsem_tryupgrade(struct rw_semaphore *rwsem)
-{
- typeof(rwsem->count) val;
- val = cmpxchg(&rwsem->count, SPL_RWSEM_SINGLE_READER_VALUE,
- SPL_RWSEM_SINGLE_WRITER_VALUE);
- return (val == SPL_RWSEM_SINGLE_READER_VALUE);
-}
-#endif
-#else
-static int
-__rwsem_tryupgrade(struct rw_semaphore *rwsem)
-{
- return (0);
-}
-#endif
-
-int
-rwsem_tryupgrade(struct rw_semaphore *rwsem)
-{
- if (__rwsem_tryupgrade(rwsem)) {
- rwsem_release(&rwsem->dep_map, 1, _RET_IP_);
- rwsem_acquire(&rwsem->dep_map, 0, 1, _RET_IP_);
- return (1);
- }
- return (0);
-}
-EXPORT_SYMBOL(rwsem_tryupgrade);
-
int spl_rw_init(void) { return 0; }
void spl_rw_fini(void) { }