test.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #include <linux/gfp.h>
  3. #include <linux/types.h>
  4. #include <linux/radix-tree.h>
  5. #include <linux/rcupdate.h>
  6. struct item {
  7. struct rcu_head rcu_head;
  8. unsigned long index;
  9. unsigned int order;
  10. };
  11. struct item *item_create(unsigned long index, unsigned int order);
  12. int __item_insert(struct radix_tree_root *root, struct item *item);
  13. int item_insert(struct radix_tree_root *root, unsigned long index);
  14. void item_sanity(struct item *item, unsigned long index);
  15. int item_insert_order(struct radix_tree_root *root, unsigned long index,
  16. unsigned order);
  17. int item_delete(struct radix_tree_root *root, unsigned long index);
  18. int item_delete_rcu(struct radix_tree_root *root, unsigned long index);
  19. struct item *item_lookup(struct radix_tree_root *root, unsigned long index);
  20. void item_check_present(struct radix_tree_root *root, unsigned long index);
  21. void item_check_absent(struct radix_tree_root *root, unsigned long index);
  22. void item_gang_check_present(struct radix_tree_root *root,
  23. unsigned long start, unsigned long nr,
  24. int chunk, int hop);
  25. void item_full_scan(struct radix_tree_root *root, unsigned long start,
  26. unsigned long nr, int chunk);
  27. void item_kill_tree(struct radix_tree_root *root);
  28. int tag_tagged_items(struct radix_tree_root *, pthread_mutex_t *,
  29. unsigned long start, unsigned long end, unsigned batch,
  30. unsigned iftag, unsigned thentag);
  31. unsigned long find_item(struct radix_tree_root *, void *item);
  32. void tag_check(void);
  33. void multiorder_checks(void);
  34. void iteration_test(unsigned order, unsigned duration);
  35. void benchmark(void);
  36. void idr_checks(void);
  37. void ida_tests(void);
  38. struct item *
  39. item_tag_set(struct radix_tree_root *root, unsigned long index, int tag);
  40. struct item *
  41. item_tag_clear(struct radix_tree_root *root, unsigned long index, int tag);
  42. int item_tag_get(struct radix_tree_root *root, unsigned long index, int tag);
  43. void tree_verify_min_height(struct radix_tree_root *root, int maxindex);
  44. void verify_tag_consistency(struct radix_tree_root *root, unsigned int tag);
  45. extern int nr_allocated;
  46. /* Normally private parts of lib/radix-tree.c */
  47. struct radix_tree_node *entry_to_node(void *ptr);
  48. void radix_tree_dump(struct radix_tree_root *root);
  49. int root_tag_get(struct radix_tree_root *root, unsigned int tag);
  50. unsigned long node_maxindex(struct radix_tree_node *);
  51. unsigned long shift_maxindex(unsigned int shift);
  52. int radix_tree_cpu_dead(unsigned int cpu);
  53. struct radix_tree_preload {
  54. unsigned nr;
  55. struct radix_tree_node *nodes;
  56. };
  57. extern struct radix_tree_preload radix_tree_preloads;