netfilter: nf_conntrack: fix hash resizing with namespaces
[safe/jmp/linux-2.6] / include / linux / plist.h
index 85de2f0..8227f71 100644 (file)
@@ -81,7 +81,8 @@ struct plist_head {
        struct list_head prio_list;
        struct list_head node_list;
 #ifdef CONFIG_DEBUG_PI_LIST
-       spinlock_t *lock;
+       raw_spinlock_t *rawlock;
+       spinlock_t *spinlock;
 #endif
 };
 
@@ -91,11 +92,17 @@ struct plist_node {
 };
 
 #ifdef CONFIG_DEBUG_PI_LIST
-# define PLIST_HEAD_LOCK_INIT(_lock)   .lock = _lock
+# define PLIST_HEAD_LOCK_INIT(_lock)           .spinlock = _lock
+# define PLIST_HEAD_LOCK_INIT_RAW(_lock)       .rawlock = _lock
 #else
 # define PLIST_HEAD_LOCK_INIT(_lock)
+# define PLIST_HEAD_LOCK_INIT_RAW(_lock)
 #endif
 
+#define _PLIST_HEAD_INIT(head)                         \
+       .prio_list = LIST_HEAD_INIT((head).prio_list),  \
+       .node_list = LIST_HEAD_INIT((head).node_list)
+
 /**
  * PLIST_HEAD_INIT - static struct plist_head initializer
  * @head:      struct plist_head variable name
@@ -103,12 +110,22 @@ struct plist_node {
  */
 #define PLIST_HEAD_INIT(head, _lock)                   \
 {                                                      \
-       .prio_list = LIST_HEAD_INIT((head).prio_list),  \
-       .node_list = LIST_HEAD_INIT((head).node_list),  \
+       _PLIST_HEAD_INIT(head),                         \
        PLIST_HEAD_LOCK_INIT(&(_lock))                  \
 }
 
 /**
+ * PLIST_HEAD_INIT_RAW - static struct plist_head initializer
+ * @head:      struct plist_head variable name
+ * @_lock:     lock to initialize for this list
+ */
+#define PLIST_HEAD_INIT_RAW(head, _lock)               \
+{                                                      \
+       _PLIST_HEAD_INIT(head),                         \
+       PLIST_HEAD_LOCK_INIT_RAW(&(_lock))              \
+}
+
+/**
  * PLIST_NODE_INIT - static struct plist_node initializer
  * @node:      struct plist_node variable name
  * @__prio:    initial node priority
@@ -116,13 +133,13 @@ struct plist_node {
 #define PLIST_NODE_INIT(node, __prio)                  \
 {                                                      \
        .prio  = (__prio),                              \
-       .plist = PLIST_HEAD_INIT((node).plist, NULL),   \
+       .plist = { _PLIST_HEAD_INIT((node).plist) },    \
 }
 
 /**
  * plist_head_init - dynamic struct plist_head initializer
  * @head:      &struct plist_head pointer
- * @lock:      list spinlock, remembered for debugging
+ * @lock:      spinlock protecting the list (debugging)
  */
 static inline void
 plist_head_init(struct plist_head *head, spinlock_t *lock)
@@ -130,7 +147,24 @@ plist_head_init(struct plist_head *head, spinlock_t *lock)
        INIT_LIST_HEAD(&head->prio_list);
        INIT_LIST_HEAD(&head->node_list);
 #ifdef CONFIG_DEBUG_PI_LIST
-       head->lock = lock;
+       head->spinlock = lock;
+       head->rawlock = NULL;
+#endif
+}
+
+/**
+ * plist_head_init_raw - dynamic struct plist_head initializer
+ * @head:      &struct plist_head pointer
+ * @lock:      raw_spinlock protecting the list (debugging)
+ */
+static inline void
+plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
+{
+       INIT_LIST_HEAD(&head->prio_list);
+       INIT_LIST_HEAD(&head->node_list);
+#ifdef CONFIG_DEBUG_PI_LIST
+       head->rawlock = lock;
+       head->spinlock = NULL;
 #endif
 }