Lines Matching refs:tree
36 void extent_map_tree_init(struct extent_map_tree *tree) in extent_map_tree_init() argument
38 tree->map = RB_ROOT_CACHED; in extent_map_tree_init()
39 INIT_LIST_HEAD(&tree->modified_extents); in extent_map_tree_init()
40 rwlock_init(&tree->lock); in extent_map_tree_init()
235 static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em) in try_merge_map() argument
265 rb_erase_cached(&merge->rb_node, &tree->map); in try_merge_map()
277 rb_erase_cached(&merge->rb_node, &tree->map); in try_merge_map()
296 int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, in unpin_extent_cache() argument
303 write_lock(&tree->lock); in unpin_extent_cache()
304 em = lookup_extent_mapping(tree, start, len); in unpin_extent_cache()
321 try_merge_map(tree, em); in unpin_extent_cache()
330 write_unlock(&tree->lock); in unpin_extent_cache()
335 void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em) in clear_em_logging() argument
339 try_merge_map(tree, em); in clear_em_logging()
342 static inline void setup_extent_mapping(struct extent_map_tree *tree, in setup_extent_mapping() argument
351 list_move(&em->list, &tree->modified_extents); in setup_extent_mapping()
353 try_merge_map(tree, em); in setup_extent_mapping()
400 int add_extent_mapping(struct extent_map_tree *tree, in add_extent_mapping() argument
405 lockdep_assert_held_write(&tree->lock); in add_extent_mapping()
407 ret = tree_insert(&tree->map, em); in add_extent_mapping()
411 setup_extent_mapping(tree, em, modified); in add_extent_mapping()
421 __lookup_extent_mapping(struct extent_map_tree *tree, in __lookup_extent_mapping() argument
430 rb_node = __tree_search(&tree->map.rb_root, start, &prev, &next); in __lookup_extent_mapping()
460 struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree, in lookup_extent_mapping() argument
463 return __lookup_extent_mapping(tree, start, len, 1); in lookup_extent_mapping()
477 struct extent_map *search_extent_mapping(struct extent_map_tree *tree, in search_extent_mapping() argument
480 return __lookup_extent_mapping(tree, start, len, 0); in search_extent_mapping()
491 void remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em) in remove_extent_mapping() argument
494 rb_erase_cached(&em->rb_node, &tree->map); in remove_extent_mapping()
502 void replace_extent_mapping(struct extent_map_tree *tree, in replace_extent_mapping() argument
511 rb_replace_node_cached(&cur->rb_node, &new->rb_node, &tree->map); in replace_extent_mapping()
514 setup_extent_mapping(tree, new, modified); in replace_extent_mapping()