diff options
author | Filipe Manana <fdmanana@suse.com> | 2024-10-24 12:07:51 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-11-11 14:34:21 +0100 |
commit | 7f13360ef954ed18ea51eea1171a7623b4d3233f (patch) | |
tree | 50d002e07c7a22b67e2eb4b4a86e73bd29bba0f4 /fs/btrfs | |
parent | 928ed1349dd7ca9028ceef5c344391105351e331 (diff) | |
download | lwn-7f13360ef954ed18ea51eea1171a7623b4d3233f.tar.gz lwn-7f13360ef954ed18ea51eea1171a7623b4d3233f.zip |
btrfs: remove no longer used delayed ref head search functionality
After the previous patch, which converted the rb-tree used to track
delayed ref heads into an xarray, the find_ref_head() function is now
used only by one caller which always passes false to the 'return_bigger'
argument. So remove the 'return_bigger' logic, simplifying the function,
and move all the function code to the single caller.
Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/delayed-ref.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 711ac31cd635..4d2ad5b66928 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -355,34 +355,6 @@ static struct btrfs_delayed_ref_head *find_first_ref_head( return xa_find(&dr->head_refs, &from, ULONG_MAX, XA_PRESENT); } -/* - * Find a head entry based on bytenr. This returns the delayed ref head if it - * was able to find one, or NULL if nothing was in that spot. If return_bigger - * is given, the next bigger entry is returned if no exact match is found. - */ -static struct btrfs_delayed_ref_head *find_ref_head( - const struct btrfs_fs_info *fs_info, - struct btrfs_delayed_ref_root *dr, u64 bytenr, - bool return_bigger) -{ - const unsigned long target_index = (bytenr >> fs_info->sectorsize_bits); - unsigned long found_index = target_index; - struct btrfs_delayed_ref_head *entry; - - lockdep_assert_held(&dr->lock); - - entry = xa_find(&dr->head_refs, &found_index, ULONG_MAX, XA_PRESENT); - if (!entry) - return NULL; - - ASSERT(found_index >= target_index); - - if (found_index != target_index && !return_bigger) - return NULL; - - return entry; -} - static bool btrfs_delayed_ref_lock(struct btrfs_delayed_ref_root *delayed_refs, struct btrfs_delayed_ref_head *head) { @@ -1184,7 +1156,11 @@ btrfs_find_delayed_ref_head(const struct btrfs_fs_info *fs_info, struct btrfs_delayed_ref_root *delayed_refs, u64 bytenr) { - return find_ref_head(fs_info, delayed_refs, bytenr, false); + const unsigned long index = (bytenr >> fs_info->sectorsize_bits); + + lockdep_assert_held(&delayed_refs->lock); + + return xa_load(&delayed_refs->head_refs, index); } static int find_comp(struct btrfs_delayed_ref_node *entry, u64 root, u64 parent) |