Message ID | 7e8a8cc96cc25b31df62ce8a3492c690dc25608d.1712837044.git.fdmanana@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: add a shrinker for extent maps | expand |
在 2024/4/12 01:49, fdmanana@kernel.org 写道: > From: Filipe Manana <fdmanana@suse.com> > > 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. > > Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/extent_map.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c > index 15817b842c24..2753bf2964cb 100644 > --- a/fs/btrfs/extent_map.c > +++ b/fs/btrfs/extent_map.c > @@ -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)
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 15817b842c24..2753bf2964cb 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -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)