Commit 002f3a2c authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

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

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
clear_em_logging().

In order to facilitate an upcoming change that adds a shrinker for extent
maps, change clear_em_logging() to receive the inode instead of its extent
map tree.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
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 6c566def
...@@ -331,8 +331,10 @@ int unpin_extent_cache(struct btrfs_inode *inode, u64 start, u64 len, u64 gen) ...@@ -331,8 +331,10 @@ int unpin_extent_cache(struct btrfs_inode *inode, u64 start, u64 len, u64 gen)
} }
void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em) void clear_em_logging(struct btrfs_inode *inode, struct extent_map *em)
{ {
struct extent_map_tree *tree = &inode->extent_tree;
lockdep_assert_held_write(&tree->lock); lockdep_assert_held_write(&tree->lock);
em->flags &= ~EXTENT_FLAG_LOGGING; em->flags &= ~EXTENT_FLAG_LOGGING;
......
...@@ -129,7 +129,7 @@ void free_extent_map(struct extent_map *em); ...@@ -129,7 +129,7 @@ void free_extent_map(struct extent_map *em);
int __init extent_map_init(void); int __init extent_map_init(void);
void __cold extent_map_exit(void); void __cold extent_map_exit(void);
int unpin_extent_cache(struct btrfs_inode *inode, u64 start, u64 len, u64 gen); int unpin_extent_cache(struct btrfs_inode *inode, u64 start, u64 len, u64 gen);
void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em); void clear_em_logging(struct btrfs_inode *inode, struct extent_map *em);
struct extent_map *search_extent_mapping(struct extent_map_tree *tree, struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
u64 start, u64 len); u64 start, u64 len);
int btrfs_add_extent_mapping(struct btrfs_inode *inode, int btrfs_add_extent_mapping(struct btrfs_inode *inode,
......
...@@ -4949,7 +4949,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4949,7 +4949,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
* private list. * private list.
*/ */
if (ret) { if (ret) {
clear_em_logging(tree, em); clear_em_logging(inode, em);
free_extent_map(em); free_extent_map(em);
continue; continue;
} }
...@@ -4958,7 +4958,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4958,7 +4958,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
ret = log_one_extent(trans, inode, em, path, ctx); ret = log_one_extent(trans, inode, em, path, ctx);
write_lock(&tree->lock); write_lock(&tree->lock);
clear_em_logging(tree, em); clear_em_logging(inode, em);
free_extent_map(em); free_extent_map(em);
} }
WARN_ON(!list_empty(&extents)); WARN_ON(!list_empty(&extents));
......
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