diff options
author | Darik Horn <[email protected]> | 2012-01-11 11:44:34 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-01-11 16:28:05 -0800 |
commit | 588d900433b03e33e4bbbfee7309bd15f71148fb (patch) | |
tree | f5176c56eb87832d869e9092a710e7d74980d6f7 /include/sys/rwlock.h | |
parent | 5f6c14b1eda9c7b47d11a3b90e78dea6a7f429e0 (diff) |
Linux 3.2 compat: rw_semaphore.wait_lock is raw
The wait_lock member of the rw_semaphore struct became a raw_spinlock_t
in Linux 3.2 at torvalds/linux@ddb6c9b58a19edcfac93ac670b066c836ff729f1.
Wrap spin_lock_* function calls in a new spl_rwsem_* interface to
ensure type safety if raw_spinlock_t becomes architecture specific,
and to satisfy these compiler warnings:
warning: passing argument 1 of ‘spinlock_check’
from incompatible pointer type [enabled by default]
note: expected ‘struct spinlock_t *’
but argument is of type ‘struct raw_spinlock_t *’
Signed-off-by: Brian Behlendorf <[email protected]>
Closes: #76
Closes: zfsonlinux/zfs#463
Diffstat (limited to 'include/sys/rwlock.h')
-rw-r--r-- | include/sys/rwlock.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h index 3d9808599..9d29ad679 100644 --- a/include/sys/rwlock.h +++ b/include/sys/rwlock.h @@ -52,9 +52,9 @@ spl_rw_set_owner(krwlock_t *rwp) { unsigned long flags; - spin_lock_irqsave(&SEM(rwp)->wait_lock, flags); + spl_rwsem_lock_irqsave(&SEM(rwp)->wait_lock, flags); rwp->rw_owner = current; - spin_unlock_irqrestore(&SEM(rwp)->wait_lock, flags); + spl_rwsem_unlock_irqrestore(&SEM(rwp)->wait_lock, flags); } static inline void @@ -62,9 +62,9 @@ spl_rw_clear_owner(krwlock_t *rwp) { unsigned long flags; - spin_lock_irqsave(&SEM(rwp)->wait_lock, flags); + spl_rwsem_lock_irqsave(&SEM(rwp)->wait_lock, flags); rwp->rw_owner = NULL; - spin_unlock_irqrestore(&SEM(rwp)->wait_lock, flags); + spl_rwsem_unlock_irqrestore(&SEM(rwp)->wait_lock, flags); } static inline kthread_t * @@ -73,9 +73,9 @@ rw_owner(krwlock_t *rwp) unsigned long flags; kthread_t *owner; - spin_lock_irqsave(&SEM(rwp)->wait_lock, flags); + spl_rwsem_lock_irqsave(&SEM(rwp)->wait_lock, flags); owner = rwp->rw_owner; - spin_unlock_irqrestore(&SEM(rwp)->wait_lock, flags); + spl_rwsem_unlock_irqrestore(&SEM(rwp)->wait_lock, flags); return owner; } @@ -187,14 +187,14 @@ extern int __down_write_trylock_locked(struct rw_semaphore *); unsigned long _flags_; \ int _rc_ = 0; \ \ - spin_lock_irqsave(&SEM(rwp)->wait_lock, _flags_); \ + spl_rwsem_lock_irqsave(&SEM(rwp)->wait_lock, _flags_); \ if ((list_empty(&SEM(rwp)->wait_list)) && \ (SEM(rwp)->activity == 1)) { \ __up_read_locked(SEM(rwp)); \ VERIFY(_rc_ = __down_write_trylock_locked(SEM(rwp))); \ (rwp)->rw_owner = current; \ } \ - spin_unlock_irqrestore(&SEM(rwp)->wait_lock, _flags_); \ + spl_rwsem_unlock_irqrestore(&SEM(rwp)->wait_lock, _flags_); \ _rc_; \ }) #else |