Skip to content

Commit 5e1f360

Browse files
fdmananakdave
authored andcommitted
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 <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 1cee528 commit 5e1f360

File tree

1 file changed

+5
-29
lines changed

1 file changed

+5
-29
lines changed

fs/btrfs/delayed-ref.c

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -355,34 +355,6 @@ static struct btrfs_delayed_ref_head *find_first_ref_head(
355355
return xa_find(&dr->head_refs, &from, ULONG_MAX, XA_PRESENT);
356356
}
357357

358-
/*
359-
* Find a head entry based on bytenr. This returns the delayed ref head if it
360-
* was able to find one, or NULL if nothing was in that spot. If return_bigger
361-
* is given, the next bigger entry is returned if no exact match is found.
362-
*/
363-
static struct btrfs_delayed_ref_head *find_ref_head(
364-
const struct btrfs_fs_info *fs_info,
365-
struct btrfs_delayed_ref_root *dr, u64 bytenr,
366-
bool return_bigger)
367-
{
368-
const unsigned long target_index = (bytenr >> fs_info->sectorsize_bits);
369-
unsigned long found_index = target_index;
370-
struct btrfs_delayed_ref_head *entry;
371-
372-
lockdep_assert_held(&dr->lock);
373-
374-
entry = xa_find(&dr->head_refs, &found_index, ULONG_MAX, XA_PRESENT);
375-
if (!entry)
376-
return NULL;
377-
378-
ASSERT(found_index >= target_index);
379-
380-
if (found_index != target_index && !return_bigger)
381-
return NULL;
382-
383-
return entry;
384-
}
385-
386358
static bool btrfs_delayed_ref_lock(struct btrfs_delayed_ref_root *delayed_refs,
387359
struct btrfs_delayed_ref_head *head)
388360
{
@@ -1184,7 +1156,11 @@ btrfs_find_delayed_ref_head(const struct btrfs_fs_info *fs_info,
11841156
struct btrfs_delayed_ref_root *delayed_refs,
11851157
u64 bytenr)
11861158
{
1187-
return find_ref_head(fs_info, delayed_refs, bytenr, false);
1159+
const unsigned long index = (bytenr >> fs_info->sectorsize_bits);
1160+
1161+
lockdep_assert_held(&delayed_refs->lock);
1162+
1163+
return xa_load(&delayed_refs->head_refs, index);
11881164
}
11891165

11901166
static int find_comp(struct btrfs_delayed_ref_node *entry, u64 root, u64 parent)

0 commit comments

Comments
 (0)