blob: 0f8220cc61663ffa2a872db42c96b4e5433ed0a7 [file] [log] [blame]
Matthew Wilcox1366c372016-03-17 14:21:45 -07001#include <linux/gfp.h>
2#include <linux/types.h>
3#include <linux/radix-tree.h>
4#include <linux/rcupdate.h>
5
6struct item {
7 unsigned long index;
Matthew Wilcox101d9602016-12-14 15:08:23 -08008 unsigned int order;
Matthew Wilcox1366c372016-03-17 14:21:45 -07009};
10
Matthew Wilcox101d9602016-12-14 15:08:23 -080011struct item *item_create(unsigned long index, unsigned int order);
12int __item_insert(struct radix_tree_root *root, struct item *item);
Matthew Wilcox1366c372016-03-17 14:21:45 -070013int item_insert(struct radix_tree_root *root, unsigned long index);
Matthew Wilcox4f3755d2016-05-20 17:02:14 -070014int item_insert_order(struct radix_tree_root *root, unsigned long index,
15 unsigned order);
Matthew Wilcox1366c372016-03-17 14:21:45 -070016int item_delete(struct radix_tree_root *root, unsigned long index);
17struct item *item_lookup(struct radix_tree_root *root, unsigned long index);
18
19void item_check_present(struct radix_tree_root *root, unsigned long index);
20void item_check_absent(struct radix_tree_root *root, unsigned long index);
21void item_gang_check_present(struct radix_tree_root *root,
22 unsigned long start, unsigned long nr,
23 int chunk, int hop);
24void item_full_scan(struct radix_tree_root *root, unsigned long start,
25 unsigned long nr, int chunk);
26void item_kill_tree(struct radix_tree_root *root);
27
Matthew Wilcox268f42d2016-12-14 15:08:55 -080028int tag_tagged_items(struct radix_tree_root *, pthread_mutex_t *,
29 unsigned long start, unsigned long end, unsigned batch,
30 unsigned iftag, unsigned thentag);
Matthew Wilcox478922e2016-12-14 15:08:52 -080031unsigned long find_item(struct radix_tree_root *, void *item);
32
Matthew Wilcox1366c372016-03-17 14:21:45 -070033void tag_check(void);
Matthew Wilcox4f3755d2016-05-20 17:02:14 -070034void multiorder_checks(void);
Matthew Wilcox3e3cdc62016-12-14 15:09:10 -080035void iteration_test(unsigned order, unsigned duration);
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -080036void benchmark(void);
Matthew Wilcox0a835c42016-12-20 10:27:56 -050037void idr_checks(void);
38void ida_checks(void);
Matthew Wilcox4ecd9542017-03-03 12:16:10 -050039void ida_thread_tests(void);
Matthew Wilcox1366c372016-03-17 14:21:45 -070040
41struct item *
42item_tag_set(struct radix_tree_root *root, unsigned long index, int tag);
43struct item *
44item_tag_clear(struct radix_tree_root *root, unsigned long index, int tag);
45int item_tag_get(struct radix_tree_root *root, unsigned long index, int tag);
46void tree_verify_min_height(struct radix_tree_root *root, int maxindex);
47void verify_tag_consistency(struct radix_tree_root *root, unsigned int tag);
48
49extern int nr_allocated;
50
51/* Normally private parts of lib/radix-tree.c */
Matthew Wilcox148deab2016-12-14 15:08:49 -080052struct radix_tree_node *entry_to_node(void *ptr);
Ross Zwisler0796c582016-05-20 17:02:55 -070053void radix_tree_dump(struct radix_tree_root *root);
Matthew Wilcox1366c372016-03-17 14:21:45 -070054int root_tag_get(struct radix_tree_root *root, unsigned int tag);
Matthew Wilcox0694f0c2016-05-20 17:03:16 -070055unsigned long node_maxindex(struct radix_tree_node *);
56unsigned long shift_maxindex(unsigned int shift);
Matthew Wilcox6df5ee72016-12-14 15:08:05 -080057int radix_tree_cpu_dead(unsigned int cpu);
Matthew Wilcox27916532016-12-14 15:09:04 -080058struct radix_tree_preload {
59 unsigned nr;
60 struct radix_tree_node *nodes;
61};
62extern struct radix_tree_preload radix_tree_preloads;