btrfs: pass the extent map tree's inode to setup_extent_mapping()

Extent maps are always associated to an inode's extent map tree, so
there's no need to pass the extent map tree explicitly to
setup_extent_mapping().

In order to facilitate an upcoming change that adds a shrinker for extent
maps, change setup_extent_mapping() to receive the inode instead of its
extent map tree.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Filipe Manana 2024-04-11 11:29:17 +01:00 committed by David Sterba
parent 6a3a9113ae
commit e778724a5e

View File

@ -342,7 +342,7 @@ void clear_em_logging(struct btrfs_inode *inode, struct extent_map *em)
try_merge_map(tree, em);
}
static inline void setup_extent_mapping(struct extent_map_tree *tree,
static inline void setup_extent_mapping(struct btrfs_inode *inode,
struct extent_map *em,
int modified)
{
@ -351,9 +351,9 @@ static inline void setup_extent_mapping(struct extent_map_tree *tree,
ASSERT(list_empty(&em->list));
if (modified)
list_add(&em->list, &tree->modified_extents);
list_add(&em->list, &inode->extent_tree.modified_extents);
else
try_merge_map(tree, em);
try_merge_map(&inode->extent_tree, em);
}
/*
@ -381,7 +381,7 @@ static int add_extent_mapping(struct btrfs_inode *inode,
if (ret)
return ret;
setup_extent_mapping(tree, em, modified);
setup_extent_mapping(inode, em, modified);
return 0;
}
@ -486,7 +486,7 @@ static void replace_extent_mapping(struct btrfs_inode *inode,
rb_replace_node_cached(&cur->rb_node, &new->rb_node, &tree->map);
RB_CLEAR_NODE(&cur->rb_node);
setup_extent_mapping(tree, new, modified);
setup_extent_mapping(inode, new, modified);
}
static struct extent_map *next_extent_map(const struct extent_map *em)