mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 00:21:17 +00:00
add hlist_bl_lock/unlock helpers
Now that the whole dcache_hash_bucket crap is gone, go all the way and also remove the weird locking layering violations for locking the hash buckets. Add hlist_bl_lock/unlock helpers to move the locking into the list abstraction instead of requiring each caller to open code it. After all allowing for the bit locks is the whole point of these helpers over the plain hlist variant. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
3dd2ee4824
commit
1879fd6a26
3 changed files with 19 additions and 20 deletions
|
@ -2,6 +2,7 @@
|
|||
#define _LINUX_LIST_BL_H
|
||||
|
||||
#include <linux/list.h>
|
||||
#include <linux/bit_spinlock.h>
|
||||
|
||||
/*
|
||||
* Special version of lists, where head of the list has a lock in the lowest
|
||||
|
@ -114,6 +115,16 @@ static inline void hlist_bl_del_init(struct hlist_bl_node *n)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void hlist_bl_lock(struct hlist_bl_head *b)
|
||||
{
|
||||
bit_spin_lock(0, (unsigned long *)b);
|
||||
}
|
||||
|
||||
static inline void hlist_bl_unlock(struct hlist_bl_head *b)
|
||||
{
|
||||
__bit_spin_unlock(0, (unsigned long *)b);
|
||||
}
|
||||
|
||||
/**
|
||||
* hlist_bl_for_each_entry - iterate over list of given type
|
||||
* @tpos: the type * to use as a loop cursor.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue