]> git.hungrycats.org Git - bees/commit
btrfs-tree: introduce BtrfsDataExtentTreeFetcher to read data extents without metadata
authorZygo Blaxell <bees@furryterror.org>
Tue, 28 Jan 2025 00:54:07 +0000 (19:54 -0500)
committerZygo Blaxell <bees@furryterror.org>
Fri, 7 Feb 2025 03:42:15 +0000 (22:42 -0500)
commitf9a697518d0f87fc69431cfc5720051378d10e1b
treed2432271666658386fae5bccaadc16e77c8de801
parentc4ba6ec269c9f202905562ba196d72c351a4e863
btrfs-tree: introduce BtrfsDataExtentTreeFetcher to read data extents without metadata

Binary searches can be extremely slow if the target bytenr is near a
metadata block group, because metadata items are not visible to the
binary search algorithm.  In a non-mixed-bg filesystem, there can be
hundreds of thousands of metadata items between data extent items, and
since the binary search algorithm can't see them, it will run searches
that iterate over hundreds of thousands of objects about a dozen times.

This is less of a problem for mixed-bg filesystems because the data and
metadata blocks are not isolated from each other.  The binary search
algorithm still can't see the metadata items, but there are usually
some data items close by to prevent the linear item filter from running
too long.

Introduce a new fetcher class (all the good names were taken) that tracks
where the end of the current block group is.  When the end of the current
block group is reached in the linear search, skip ahead to a block group
that can contain data items.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
include/crucible/btrfs-tree.h
lib/btrfs-tree.cc