]> git.hungrycats.org Git - bees/commitdiff
btrfs-tree: add root refs and extent flags fields
authorZygo Blaxell <bees@furryterror.org>
Wed, 20 Nov 2024 15:15:53 +0000 (10:15 -0500)
committerZygo Blaxell <bees@furryterror.org>
Sun, 1 Dec 2024 04:30:33 +0000 (23:30 -0500)
Lazily filling in accessor methods for btrfs objects as needed by bees.

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

index 44241da85244e044a3f304abad674b8bd0d27ee7..1c67b2506bf6d647b26b1b235923d834636aa95b 100644 (file)
@@ -64,11 +64,13 @@ namespace crucible {
                /// @{ Extent items (EXTENT_ITEM)
                uint64_t extent_begin() const;
                uint64_t extent_end() const;
+               uint64_t extent_flags() const;
                uint64_t extent_generation() const;
                /// @}
 
                /// @{ Root items
                uint64_t root_flags() const;
+               uint64_t root_refs() const;
                /// @}
 
                /// @{ Root backref items.
index d597d682c0bae9b40d586f2244eebdfdc5854244..14073cbb64325dd27a4f7c5d0423be98568d56b8 100644 (file)
@@ -22,6 +22,13 @@ namespace crucible {
                return m_objectid + m_offset;
        }
 
+       uint64_t
+       BtrfsTreeItem::extent_flags() const
+       {
+               THROW_CHECK1(invalid_argument, btrfs_search_type_ntoa(m_type), m_type == BTRFS_EXTENT_ITEM_KEY);
+               return btrfs_get_member(&btrfs_extent_item::flags, m_data);
+       }
+
        uint64_t
        BtrfsTreeItem::extent_generation() const
        {
@@ -61,6 +68,13 @@ namespace crucible {
                return btrfs_get_member(&btrfs_root_item::flags, m_data);
        }
 
+       uint64_t
+       BtrfsTreeItem::root_refs() const
+       {
+               THROW_CHECK1(invalid_argument, btrfs_search_type_ntoa(m_type), m_type == BTRFS_ROOT_ITEM_KEY);
+               return btrfs_get_member(&btrfs_root_item::refs, m_data);
+       }
+
        ostream &
        operator<<(ostream &os, const BtrfsTreeItem &bti)
        {