diff options
author | Jiri Kosina <jkosina@suse.cz> | 2011-09-15 09:08:05 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-09-15 09:08:18 -0400 |
commit | e060c38434b2caa78efe7cedaff4191040b65a15 (patch) | |
tree | 407361230bf6733f63d8e788e4b5e6566ee04818 /include/linux/radix-tree.h | |
parent | 10e4ac572eeffe5317019bd7330b6058a400dfc2 (diff) | |
parent | cc39c6a9bbdebfcf1a7dee64d83bf302bc38d941 (diff) |
Merge branch 'master' into for-next
Fast-forward merge with Linus to be able to merge patches
based on more recent version of the tree.
Diffstat (limited to 'include/linux/radix-tree.h')
-rw-r--r-- | include/linux/radix-tree.h | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 23241c2fecce..9d4539c52e53 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -39,7 +39,15 @@ | |||
39 | * when it is shrunk, before we rcu free the node. See shrink code for | 39 | * when it is shrunk, before we rcu free the node. See shrink code for |
40 | * details. | 40 | * details. |
41 | */ | 41 | */ |
42 | #define RADIX_TREE_INDIRECT_PTR 1 | 42 | #define RADIX_TREE_INDIRECT_PTR 1 |
43 | /* | ||
44 | * A common use of the radix tree is to store pointers to struct pages; | ||
45 | * but shmem/tmpfs needs also to store swap entries in the same tree: | ||
46 | * those are marked as exceptional entries to distinguish them. | ||
47 | * EXCEPTIONAL_ENTRY tests the bit, EXCEPTIONAL_SHIFT shifts content past it. | ||
48 | */ | ||
49 | #define RADIX_TREE_EXCEPTIONAL_ENTRY 2 | ||
50 | #define RADIX_TREE_EXCEPTIONAL_SHIFT 2 | ||
43 | 51 | ||
44 | #define radix_tree_indirect_to_ptr(ptr) \ | 52 | #define radix_tree_indirect_to_ptr(ptr) \ |
45 | radix_tree_indirect_to_ptr((void __force *)(ptr)) | 53 | radix_tree_indirect_to_ptr((void __force *)(ptr)) |
@@ -174,6 +182,28 @@ static inline int radix_tree_deref_retry(void *arg) | |||
174 | } | 182 | } |
175 | 183 | ||
176 | /** | 184 | /** |
185 | * radix_tree_exceptional_entry - radix_tree_deref_slot gave exceptional entry? | ||
186 | * @arg: value returned by radix_tree_deref_slot | ||
187 | * Returns: 0 if well-aligned pointer, non-0 if exceptional entry. | ||
188 | */ | ||
189 | static inline int radix_tree_exceptional_entry(void *arg) | ||
190 | { | ||
191 | /* Not unlikely because radix_tree_exception often tested first */ | ||
192 | return (unsigned long)arg & RADIX_TREE_EXCEPTIONAL_ENTRY; | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * radix_tree_exception - radix_tree_deref_slot returned either exception? | ||
197 | * @arg: value returned by radix_tree_deref_slot | ||
198 | * Returns: 0 if well-aligned pointer, non-0 if either kind of exception. | ||
199 | */ | ||
200 | static inline int radix_tree_exception(void *arg) | ||
201 | { | ||
202 | return unlikely((unsigned long)arg & | ||
203 | (RADIX_TREE_INDIRECT_PTR | RADIX_TREE_EXCEPTIONAL_ENTRY)); | ||
204 | } | ||
205 | |||
206 | /** | ||
177 | * radix_tree_replace_slot - replace item in a slot | 207 | * radix_tree_replace_slot - replace item in a slot |
178 | * @pslot: pointer to slot, returned by radix_tree_lookup_slot | 208 | * @pslot: pointer to slot, returned by radix_tree_lookup_slot |
179 | * @item: new item to store in the slot. | 209 | * @item: new item to store in the slot. |
@@ -194,8 +224,8 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long); | |||
194 | unsigned int | 224 | unsigned int |
195 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | 225 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, |
196 | unsigned long first_index, unsigned int max_items); | 226 | unsigned long first_index, unsigned int max_items); |
197 | unsigned int | 227 | unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root, |
198 | radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results, | 228 | void ***results, unsigned long *indices, |
199 | unsigned long first_index, unsigned int max_items); | 229 | unsigned long first_index, unsigned int max_items); |
200 | unsigned long radix_tree_next_hole(struct radix_tree_root *root, | 230 | unsigned long radix_tree_next_hole(struct radix_tree_root *root, |
201 | unsigned long index, unsigned long max_scan); | 231 | unsigned long index, unsigned long max_scan); |
@@ -222,6 +252,7 @@ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, | |||
222 | unsigned long nr_to_tag, | 252 | unsigned long nr_to_tag, |
223 | unsigned int fromtag, unsigned int totag); | 253 | unsigned int fromtag, unsigned int totag); |
224 | int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); | 254 | int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); |
255 | unsigned long radix_tree_locate_item(struct radix_tree_root *root, void *item); | ||
225 | 256 | ||
226 | static inline void radix_tree_preload_end(void) | 257 | static inline void radix_tree_preload_end(void) |
227 | { | 258 | { |