aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/list_bl.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-04-25 14:01:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-25 21:14:10 -0400
commit1879fd6a26571fd4e8e1f4bb3e7537bc936b1fe7 (patch)
tree5fb41fdaef01d462ff9c7ecfe688760a44e89b6a /include/linux/list_bl.h
parent3dd2ee4824b668a635d6d2bb6bc73f33708cab9f (diff)
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>
Diffstat (limited to 'include/linux/list_bl.h')
-rw-r--r--include/linux/list_bl.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index 5bad17d1acde..31f9d75adc5b 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -2,6 +2,7 @@
2#define _LINUX_LIST_BL_H 2#define _LINUX_LIST_BL_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/bit_spinlock.h>
5 6
6/* 7/*
7 * Special version of lists, where head of the list has a lock in the lowest 8 * 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)
114 } 115 }
115} 116}
116 117
118static inline void hlist_bl_lock(struct hlist_bl_head *b)
119{
120 bit_spin_lock(0, (unsigned long *)b);
121}
122
123static inline void hlist_bl_unlock(struct hlist_bl_head *b)
124{
125 __bit_spin_unlock(0, (unsigned long *)b);
126}
127
117/** 128/**
118 * hlist_bl_for_each_entry - iterate over list of given type 129 * hlist_bl_for_each_entry - iterate over list of given type
119 * @tpos: the type * to use as a loop cursor. 130 * @tpos: the type * to use as a loop cursor.