diff options
Diffstat (limited to 'include/linux/radix-tree.h')
-rw-r--r-- | include/linux/radix-tree.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index ab2baa5c4884..23241c2fecce 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -146,6 +146,22 @@ static inline void *radix_tree_deref_slot(void **pslot) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * radix_tree_deref_slot_protected - dereference a slot without RCU lock but with tree lock held | ||
150 | * @pslot: pointer to slot, returned by radix_tree_lookup_slot | ||
151 | * Returns: item that was stored in that slot with any direct pointer flag | ||
152 | * removed. | ||
153 | * | ||
154 | * Similar to radix_tree_deref_slot but only used during migration when a pages | ||
155 | * mapping is being moved. The caller does not hold the RCU read lock but it | ||
156 | * must hold the tree lock to prevent parallel updates. | ||
157 | */ | ||
158 | static inline void *radix_tree_deref_slot_protected(void **pslot, | ||
159 | spinlock_t *treelock) | ||
160 | { | ||
161 | return rcu_dereference_protected(*pslot, lockdep_is_held(treelock)); | ||
162 | } | ||
163 | |||
164 | /** | ||
149 | * radix_tree_deref_retry - check radix_tree_deref_slot | 165 | * radix_tree_deref_retry - check radix_tree_deref_slot |
150 | * @arg: pointer returned by radix_tree_deref_slot | 166 | * @arg: pointer returned by radix_tree_deref_slot |
151 | * Returns: 0 if retry is not required, otherwise retry is required | 167 | * Returns: 0 if retry is not required, otherwise retry is required |