aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/list_bl.h
diff options
context:
space:
mode:
authorNick Piggin <npiggin@kernel.dk>2011-01-13 21:36:43 -0500
committerNick Piggin <npiggin@hera.kernel.org>2011-01-13 21:36:43 -0500
commit2c6755988afc003a0332406a134fb6a1626f9b28 (patch)
tree84eea829cab7b28585000f6fd7fe0dc176b746c5 /include/linux/list_bl.h
parent90dbb77ba48dddb87445d238e84cd137cf97dd98 (diff)
fs: hlist UP debug fixup
Po-Yu Chuang <ratbert.chuang@gmail.com> noticed that hlist_bl_set_first could crash on a UP system when LIST_BL_LOCKMASK is 0, because LIST_BL_BUG_ON(!((unsigned long)h->first & LIST_BL_LOCKMASK)); always evaulates to true. Fix the expression, and also avoid a dependency between bit spinlock implementation and list bl code (list code shouldn't know anything except that bit 0 is set when adding and removing elements). Eventually if a good use case comes up, we might use this list to store 1 or more arbitrary bits of data, so it really shouldn't be tied to locking either, but for now they are helpful for debugging. Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'include/linux/list_bl.h')
-rw-r--r--include/linux/list_bl.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index 9ee97e7f2be4..b2adbb4b2f73 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -16,7 +16,7 @@
16 * some fast and compact auxiliary data. 16 * some fast and compact auxiliary data.
17 */ 17 */
18 18
19#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 19#if defined(CONFIG_SMP)
20#define LIST_BL_LOCKMASK 1UL 20#define LIST_BL_LOCKMASK 1UL
21#else 21#else
22#define LIST_BL_LOCKMASK 0UL 22#define LIST_BL_LOCKMASK 0UL
@@ -62,7 +62,8 @@ static inline void hlist_bl_set_first(struct hlist_bl_head *h,
62 struct hlist_bl_node *n) 62 struct hlist_bl_node *n)
63{ 63{
64 LIST_BL_BUG_ON((unsigned long)n & LIST_BL_LOCKMASK); 64 LIST_BL_BUG_ON((unsigned long)n & LIST_BL_LOCKMASK);
65 LIST_BL_BUG_ON(!((unsigned long)h->first & LIST_BL_LOCKMASK)); 65 LIST_BL_BUG_ON(((unsigned long)h->first & LIST_BL_LOCKMASK) !=
66 LIST_BL_LOCKMASK);
66 h->first = (struct hlist_bl_node *)((unsigned long)n | LIST_BL_LOCKMASK); 67 h->first = (struct hlist_bl_node *)((unsigned long)n | LIST_BL_LOCKMASK);
67} 68}
68 69