mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 06:55:13 +08:00
btrfs: pass the extent map tree's inode to replace_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 replace_extent_mapping(). In order to facilitate an upcoming change that adds a shrinker for extent maps, change replace_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:
parent
c2fbd812d7
commit
6a3a9113ae
@ -470,11 +470,13 @@ void remove_extent_mapping(struct btrfs_inode *inode, struct extent_map *em)
|
||||
RB_CLEAR_NODE(&em->rb_node);
|
||||
}
|
||||
|
||||
static void replace_extent_mapping(struct extent_map_tree *tree,
|
||||
static void replace_extent_mapping(struct btrfs_inode *inode,
|
||||
struct extent_map *cur,
|
||||
struct extent_map *new,
|
||||
int modified)
|
||||
{
|
||||
struct extent_map_tree *tree = &inode->extent_tree;
|
||||
|
||||
lockdep_assert_held_write(&tree->lock);
|
||||
|
||||
WARN_ON(cur->flags & EXTENT_FLAG_PINNED);
|
||||
@ -777,7 +779,7 @@ void btrfs_drop_extent_map_range(struct btrfs_inode *inode, u64 start, u64 end,
|
||||
|
||||
split->generation = gen;
|
||||
split->flags = flags;
|
||||
replace_extent_mapping(em_tree, em, split, modified);
|
||||
replace_extent_mapping(inode, em, split, modified);
|
||||
free_extent_map(split);
|
||||
split = split2;
|
||||
split2 = NULL;
|
||||
@ -818,8 +820,7 @@ void btrfs_drop_extent_map_range(struct btrfs_inode *inode, u64 start, u64 end,
|
||||
}
|
||||
|
||||
if (extent_map_in_tree(em)) {
|
||||
replace_extent_mapping(em_tree, em, split,
|
||||
modified);
|
||||
replace_extent_mapping(inode, em, split, modified);
|
||||
} else {
|
||||
int ret;
|
||||
|
||||
@ -977,7 +978,7 @@ int split_extent_map(struct btrfs_inode *inode, u64 start, u64 len, u64 pre,
|
||||
split_pre->flags = flags;
|
||||
split_pre->generation = em->generation;
|
||||
|
||||
replace_extent_mapping(em_tree, em, split_pre, 1);
|
||||
replace_extent_mapping(inode, em, split_pre, 1);
|
||||
|
||||
/*
|
||||
* Now we only have an extent_map at:
|
||||
|
Loading…
Reference in New Issue
Block a user