]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/radix-tree.h
net: Fix build failure due to lockdep_sock_is_held().
[karo-tx-linux.git] / include / linux / radix-tree.h
index f54be708220760f9a367f4a29ca1cbe7cfb7fba2..51a97ac8bfbf4ed1d404f0536362ccfc13a439f3 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef _LINUX_RADIX_TREE_H
 #define _LINUX_RADIX_TREE_H
 
+#include <linux/bitops.h>
 #include <linux/preempt.h>
 #include <linux/types.h>
 #include <linux/bug.h>
@@ -270,8 +271,15 @@ static inline void radix_tree_replace_slot(void **pslot, void *item)
 }
 
 int __radix_tree_create(struct radix_tree_root *root, unsigned long index,
-                       struct radix_tree_node **nodep, void ***slotp);
-int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
+                       unsigned order, struct radix_tree_node **nodep,
+                       void ***slotp);
+int __radix_tree_insert(struct radix_tree_root *, unsigned long index,
+                       unsigned order, void *);
+static inline int radix_tree_insert(struct radix_tree_root *root,
+                       unsigned long index, void *entry)
+{
+       return __radix_tree_insert(root, index, 0, entry);
+}
 void *__radix_tree_lookup(struct radix_tree_root *root, unsigned long index,
                          struct radix_tree_node **nodep, void ***slotp);
 void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
@@ -394,6 +402,22 @@ void **radix_tree_iter_retry(struct radix_tree_iter *iter)
        return NULL;
 }
 
+/**
+ * radix_tree_iter_next - resume iterating when the chunk may be invalid
+ * @iter:      iterator state
+ *
+ * If the iterator needs to release then reacquire a lock, the chunk may
+ * have been invalidated by an insertion or deletion.  Call this function
+ * to continue the iteration from the next index.
+ */
+static inline __must_check
+void **radix_tree_iter_next(struct radix_tree_iter *iter)
+{
+       iter->next_index = iter->index + 1;
+       iter->tags = 0;
+       return NULL;
+}
+
 /**
  * radix_tree_chunk_size - get current chunk size
  *