Commit cfd7a17d authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: remove no longer used btrfs_next_extent_map()

There are no more users of btrfs_next_extent_map(), the previous patch
in the series ("btrfs: search for delalloc more efficiently during
lseek/fiemap") removed the last usage of the function, so delete it.

This change is part of a patchset that has the goal to make performance
better for applications that use lseek's SEEK_HOLE and SEEK_DATA modes to
iterate over the extents of a file. Two examples are the cp program from
coreutils 9.0+ and the tar program (when using its --sparse / -S option).
A sample test and results are listed in the changelog of the last patch
in the series:

  1/9 btrfs: remove leftover setting of EXTENT_UPTODATE state in an inode's io_tree
  2/9 btrfs: add an early exit when searching for delalloc range for lseek/fiemap
  3/9 btrfs: skip unnecessary delalloc searches during lseek/fiemap
  4/9 btrfs: search for delalloc more efficiently during lseek/fiemap
  5/9 btrfs: remove no longer used btrfs_next_extent_map()
  6/9 btrfs: allow passing a cached state record to count_range_bits()
  7/9 btrfs: update stale comment for count_range_bits()
  8/9 btrfs: use cached state when looking for delalloc ranges with fiemap
  9/9 btrfs: use cached state when looking for delalloc ranges with lseek
Reported-by: default avatarWang Yugui <wangyugui@e16-tech.com>
Link: https://lore.kernel.org/linux-btrfs/20221106073028.71F9.409509F4@e16-tech.com/
Link: https://lore.kernel.org/linux-btrfs/CAL3q7H5NSVicm7nYBJ7x8fFkDpno8z3PYt5aPU43Bajc1H0h1Q@mail.gmail.com/Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 8ddc8274
......@@ -529,35 +529,6 @@ static struct extent_map *next_extent_map(const struct extent_map *em)
return container_of(next, struct extent_map, rb_node);
}
/*
* Get the extent map that immediately follows another one.
*
* @tree: The extent map tree that the extent map belong to.
* Holding read or write access on the tree's lock is required.
* @em: An extent map from the given tree. The caller must ensure that
* between getting @em and between calling this function, the
* extent map @em is not removed from the tree - for example, by
* holding the tree's lock for the duration of those 2 operations.
*
* Returns the extent map that immediately follows @em, or NULL if @em is the
* last extent map in the tree.
*/
struct extent_map *btrfs_next_extent_map(const struct extent_map_tree *tree,
const struct extent_map *em)
{
struct extent_map *next;
/* The lock must be acquired either in read mode or write mode. */
lockdep_assert_held(&tree->lock);
ASSERT(extent_map_in_tree(em));
next = next_extent_map(em);
if (next)
refcount_inc(&next->refs);
return next;
}
static struct extent_map *prev_extent_map(struct extent_map *em)
{
struct rb_node *prev;
......
......@@ -87,8 +87,6 @@ static inline u64 extent_map_block_end(struct extent_map *em)
void extent_map_tree_init(struct extent_map_tree *tree);
struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree,
u64 start, u64 len);
struct extent_map *btrfs_next_extent_map(const struct extent_map_tree *tree,
const struct extent_map *em);
int add_extent_mapping(struct extent_map_tree *tree,
struct extent_map *em, int modified);
void remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em);
......
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