mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-01 23:53:16 -04:00
rhashtable: replace rht_ptr_locked() with rht_assign_locked()
The only times rht_ptr_locked() is used, it is to store a new value in a bucket-head. This is the only time it makes sense to use it too. So replace it by a function which does the whole task: Sets the lock bit and assigns to a bucket head. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
adc6a3ab19
commit
f4712b46a5
2 changed files with 9 additions and 6 deletions
|
@ -316,6 +316,7 @@ static inline struct rhash_lock_head __rcu **rht_bucket_insert(
|
|||
* local_bh. For that we have rht_assign_unlock(). As rcu_assign_pointer()
|
||||
* provides the same release semantics that bit_spin_unlock() provides,
|
||||
* this is safe.
|
||||
* When we write to a bucket without unlocking, we use rht_assign_locked().
|
||||
*/
|
||||
|
||||
static inline void rht_lock(struct bucket_table *tbl,
|
||||
|
@ -369,10 +370,12 @@ static inline struct rhash_head *rht_ptr_exclusive(
|
|||
return (void *)(((unsigned long)p) & ~BIT(1));
|
||||
}
|
||||
|
||||
static inline struct rhash_lock_head __rcu *rht_ptr_locked(const
|
||||
struct rhash_head *p)
|
||||
static inline void rht_assign_locked(struct rhash_lock_head __rcu **bkt,
|
||||
struct rhash_head *obj)
|
||||
{
|
||||
return (void *)(((unsigned long)p) | BIT(1));
|
||||
struct rhash_head __rcu **p = (struct rhash_head __rcu **)bkt;
|
||||
|
||||
rcu_assign_pointer(*p, (void *)((unsigned long)obj | BIT(1)));
|
||||
}
|
||||
|
||||
static inline void rht_assign_unlock(struct bucket_table *tbl,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue