]> git.hungrycats.org Git - bees/commitdiff
crawl: deprecate use of BeesCrawl to search the extent tree
authorZygo Blaxell <bees@furryterror.org>
Mon, 3 Feb 2025 23:28:55 +0000 (18:28 -0500)
committerZygo Blaxell <bees@furryterror.org>
Fri, 7 Feb 2025 03:43:22 +0000 (22:43 -0500)
BeesScanModeExtent can do that by itself now.  Overloading the subvol
crawl code resulted in an ugly, inefficient hack, and we definitely
don't want to accidentally continue to use it.

Remove the support for reading the extent tree and add some `assert`s
to make sure it isn't still used somewhere.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-roots.cc

index 4623aeb119ff4bd2d5bb3bae606b89359c4b0f33..ae96342e3063690ba4d76f5ed380661425e859ed 100644 (file)
@@ -2380,15 +2380,12 @@ BeesCrawl::fetch_extents()
 
        // Don't set max_transid to m_max_transid here.  See scan_one_ref.
        m_btof.transid(old_state.m_min_transid);
+
+       // Deprecated: don't call this on the extent tree any more
+       assert(m_btof.tree() != BTRFS_EXTENT_TREE_OBJECTID);
+
        if (catch_all([&]() {
                m_next_extent_data = m_btof.lower_bound(old_state.m_objectid);
-               if (m_btof.tree() == BTRFS_EXTENT_TREE_OBJECTID) {
-                       // Skip over TREE_BLOCK extent items, they don't have files
-                       while (!!m_next_extent_data && (m_next_extent_data.extent_flags() & BTRFS_EXTENT_FLAG_TREE_BLOCK)) {
-                               BEESCOUNT(crawl_tree_block);
-                               m_next_extent_data = m_btof.next(m_next_extent_data.objectid());
-                       }
-               }
        })) {
                // Whoops that didn't work.  Stop scanning this subvol, move on to the next.
                m_deferred = true;
@@ -2425,19 +2422,13 @@ BeesCrawl::bti_to_bfr(const BtrfsTreeItem &bti) const
        if (!bti) {
                return BeesFileRange();
        }
-       if (bti.type() == BTRFS_EXTENT_ITEM_KEY) {
-               return BeesFileRange(
-                       BeesFileId(get_state_end().m_root, bti.objectid()),
-                       bti.objectid(),
-                       bti.objectid() + bti.offset()
-               );
-       } else {
-               return BeesFileRange(
-                       BeesFileId(get_state_end().m_root, bti.objectid()),
-                       bti.offset(),
-                       bti.offset() + bti.file_extent_logical_bytes()
-               );
-       }
+       // Deprecated: don't call peek_front() or pop_front() with extent tree any more
+       assert(bti.type() != BTRFS_EXTENT_ITEM_KEY);
+       return BeesFileRange(
+               BeesFileId(get_state_end().m_root, bti.objectid()),
+               bti.offset(),
+               bti.offset() + bti.file_extent_logical_bytes()
+       );
 }
 
 BeesFileRange