Commit 7f5830bc authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: rename rb_root member of extent_map_tree from map to root

Currently we name the rb_root member of struct extent_map_tree as 'map',
which is odd and confusing. Since it's a root node, rename it to 'root'.
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 7a7bc214
...@@ -33,7 +33,7 @@ void __cold extent_map_exit(void) ...@@ -33,7 +33,7 @@ void __cold extent_map_exit(void)
*/ */
void extent_map_tree_init(struct extent_map_tree *tree) void extent_map_tree_init(struct extent_map_tree *tree)
{ {
tree->map = RB_ROOT_CACHED; tree->root = RB_ROOT_CACHED;
INIT_LIST_HEAD(&tree->modified_extents); INIT_LIST_HEAD(&tree->modified_extents);
rwlock_init(&tree->lock); rwlock_init(&tree->lock);
} }
...@@ -265,7 +265,7 @@ static void try_merge_map(struct btrfs_inode *inode, struct extent_map *em) ...@@ -265,7 +265,7 @@ static void try_merge_map(struct btrfs_inode *inode, struct extent_map *em)
em->generation = max(em->generation, merge->generation); em->generation = max(em->generation, merge->generation);
em->flags |= EXTENT_FLAG_MERGED; em->flags |= EXTENT_FLAG_MERGED;
rb_erase_cached(&merge->rb_node, &tree->map); rb_erase_cached(&merge->rb_node, &tree->root);
RB_CLEAR_NODE(&merge->rb_node); RB_CLEAR_NODE(&merge->rb_node);
free_extent_map(merge); free_extent_map(merge);
dec_evictable_extent_maps(inode); dec_evictable_extent_maps(inode);
...@@ -278,7 +278,7 @@ static void try_merge_map(struct btrfs_inode *inode, struct extent_map *em) ...@@ -278,7 +278,7 @@ static void try_merge_map(struct btrfs_inode *inode, struct extent_map *em)
if (rb && can_merge_extent_map(merge) && mergeable_maps(em, merge)) { if (rb && can_merge_extent_map(merge) && mergeable_maps(em, merge)) {
em->len += merge->len; em->len += merge->len;
em->block_len += merge->block_len; em->block_len += merge->block_len;
rb_erase_cached(&merge->rb_node, &tree->map); rb_erase_cached(&merge->rb_node, &tree->root);
RB_CLEAR_NODE(&merge->rb_node); RB_CLEAR_NODE(&merge->rb_node);
em->generation = max(em->generation, merge->generation); em->generation = max(em->generation, merge->generation);
em->flags |= EXTENT_FLAG_MERGED; em->flags |= EXTENT_FLAG_MERGED;
...@@ -389,7 +389,7 @@ static int add_extent_mapping(struct btrfs_inode *inode, ...@@ -389,7 +389,7 @@ static int add_extent_mapping(struct btrfs_inode *inode,
lockdep_assert_held_write(&tree->lock); lockdep_assert_held_write(&tree->lock);
ret = tree_insert(&tree->map, em); ret = tree_insert(&tree->root, em);
if (ret) if (ret)
return ret; return ret;
...@@ -410,7 +410,7 @@ __lookup_extent_mapping(struct extent_map_tree *tree, ...@@ -410,7 +410,7 @@ __lookup_extent_mapping(struct extent_map_tree *tree,
struct rb_node *prev_or_next = NULL; struct rb_node *prev_or_next = NULL;
u64 end = range_end(start, len); u64 end = range_end(start, len);
rb_node = __tree_search(&tree->map.rb_root, start, &prev_or_next); rb_node = __tree_search(&tree->root.rb_root, start, &prev_or_next);
if (!rb_node) { if (!rb_node) {
if (prev_or_next) if (prev_or_next)
rb_node = prev_or_next; rb_node = prev_or_next;
...@@ -479,7 +479,7 @@ void remove_extent_mapping(struct btrfs_inode *inode, struct extent_map *em) ...@@ -479,7 +479,7 @@ void remove_extent_mapping(struct btrfs_inode *inode, struct extent_map *em)
lockdep_assert_held_write(&tree->lock); lockdep_assert_held_write(&tree->lock);
WARN_ON(em->flags & EXTENT_FLAG_PINNED); WARN_ON(em->flags & EXTENT_FLAG_PINNED);
rb_erase_cached(&em->rb_node, &tree->map); rb_erase_cached(&em->rb_node, &tree->root);
if (!(em->flags & EXTENT_FLAG_LOGGING)) if (!(em->flags & EXTENT_FLAG_LOGGING))
list_del_init(&em->list); list_del_init(&em->list);
RB_CLEAR_NODE(&em->rb_node); RB_CLEAR_NODE(&em->rb_node);
...@@ -500,7 +500,7 @@ static void replace_extent_mapping(struct btrfs_inode *inode, ...@@ -500,7 +500,7 @@ static void replace_extent_mapping(struct btrfs_inode *inode,
ASSERT(extent_map_in_tree(cur)); ASSERT(extent_map_in_tree(cur));
if (!(cur->flags & EXTENT_FLAG_LOGGING)) if (!(cur->flags & EXTENT_FLAG_LOGGING))
list_del_init(&cur->list); list_del_init(&cur->list);
rb_replace_node_cached(&cur->rb_node, &new->rb_node, &tree->map); rb_replace_node_cached(&cur->rb_node, &new->rb_node, &tree->root);
RB_CLEAR_NODE(&cur->rb_node); RB_CLEAR_NODE(&cur->rb_node);
setup_extent_mapping(inode, new, modified); setup_extent_mapping(inode, new, modified);
...@@ -659,11 +659,11 @@ static void drop_all_extent_maps_fast(struct btrfs_inode *inode) ...@@ -659,11 +659,11 @@ static void drop_all_extent_maps_fast(struct btrfs_inode *inode)
struct extent_map_tree *tree = &inode->extent_tree; struct extent_map_tree *tree = &inode->extent_tree;
write_lock(&tree->lock); write_lock(&tree->lock);
while (!RB_EMPTY_ROOT(&tree->map.rb_root)) { while (!RB_EMPTY_ROOT(&tree->root.rb_root)) {
struct extent_map *em; struct extent_map *em;
struct rb_node *node; struct rb_node *node;
node = rb_first_cached(&tree->map); node = rb_first_cached(&tree->root);
em = rb_entry(node, struct extent_map, rb_node); em = rb_entry(node, struct extent_map, rb_node);
em->flags &= ~(EXTENT_FLAG_PINNED | EXTENT_FLAG_LOGGING); em->flags &= ~(EXTENT_FLAG_PINNED | EXTENT_FLAG_LOGGING);
remove_extent_mapping(inode, em); remove_extent_mapping(inode, em);
...@@ -1058,7 +1058,7 @@ static long btrfs_scan_inode(struct btrfs_inode *inode, long *scanned, long nr_t ...@@ -1058,7 +1058,7 @@ static long btrfs_scan_inode(struct btrfs_inode *inode, long *scanned, long nr_t
return 0; return 0;
write_lock(&tree->lock); write_lock(&tree->lock);
node = rb_first_cached(&tree->map); node = rb_first_cached(&tree->root);
while (node) { while (node) {
struct extent_map *em; struct extent_map *em;
...@@ -1094,7 +1094,7 @@ static long btrfs_scan_inode(struct btrfs_inode *inode, long *scanned, long nr_t ...@@ -1094,7 +1094,7 @@ static long btrfs_scan_inode(struct btrfs_inode *inode, long *scanned, long nr_t
* lock and took it again. * lock and took it again.
*/ */
if (cond_resched_rwlock_write(&tree->lock)) if (cond_resched_rwlock_write(&tree->lock))
node = rb_first_cached(&tree->map); node = rb_first_cached(&tree->root);
} }
write_unlock(&tree->lock); write_unlock(&tree->lock);
up_read(&inode->i_mmap_lock); up_read(&inode->i_mmap_lock);
......
...@@ -115,7 +115,7 @@ struct extent_map { ...@@ -115,7 +115,7 @@ struct extent_map {
}; };
struct extent_map_tree { struct extent_map_tree {
struct rb_root_cached map; struct rb_root_cached root;
struct list_head modified_extents; struct list_head modified_extents;
rwlock_t lock; rwlock_t lock;
}; };
......
...@@ -19,8 +19,8 @@ static int free_extent_map_tree(struct btrfs_inode *inode) ...@@ -19,8 +19,8 @@ static int free_extent_map_tree(struct btrfs_inode *inode)
int ret = 0; int ret = 0;
write_lock(&em_tree->lock); write_lock(&em_tree->lock);
while (!RB_EMPTY_ROOT(&em_tree->map.rb_root)) { while (!RB_EMPTY_ROOT(&em_tree->root.rb_root)) {
node = rb_first_cached(&em_tree->map); node = rb_first_cached(&em_tree->root);
em = rb_entry(node, struct extent_map, rb_node); em = rb_entry(node, struct extent_map, rb_node);
remove_extent_mapping(inode, em); remove_extent_mapping(inode, em);
...@@ -551,7 +551,7 @@ static int validate_range(struct extent_map_tree *em_tree, int index) ...@@ -551,7 +551,7 @@ static int validate_range(struct extent_map_tree *em_tree, int index)
struct rb_node *n; struct rb_node *n;
int i; int i;
for (i = 0, n = rb_first_cached(&em_tree->map); for (i = 0, n = rb_first_cached(&em_tree->root);
valid_ranges[index][i].len && n; valid_ranges[index][i].len && n;
i++, n = rb_next(n)) { i++, n = rb_next(n)) {
struct extent_map *entry = rb_entry(n, struct extent_map, rb_node); struct extent_map *entry = rb_entry(n, struct extent_map, rb_node);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment