]> git.hungrycats.org Git - bees/commit
extent-layer: merge repaired refs through the node interface
authorZygo Blaxell <bees@furryterror.org>
Tue, 1 Sep 2026 15:46:39 +0000 (11:46 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sat, 10 Oct 2026 19:00:05 +0000 (15:00 -0400)
commit8dc4bf0b8e1909c3be9cbbe7bd4a85cedcac59d3
treeb59deb115665b351df44b6062f0d88a7fbf04f87
parent85350f27c58ee0679697115aa0e79b466396689f
extent-layer: merge repaired refs through the node interface

repair_refs() reached for the concrete node type to read and publish
m_refs:

auto *node = dynamic_cast<BeesBtrfsExtentNode *>(extent.extent_sp().get());

The read never needed it -- refs() and refs(BeesExtentLayer &) are both
virtual on BeesBaseExtentNode.  Only publishing a merged list had no
base-class expression, so add one: merge_refs() appends refs whose
(root, inum, offset) the node does not already hold, under the node's
own lock, and returns how many were added.  Node types with no btrfs ref
list inherit a no-op, which is the right answer for them rather than
something a cast has to exclude by returning early.

Constructing the ref nodes stays in the layer.  The donors describe file
ranges but their nodes still name the dst extent they came from, so each
one is rebased onto this extent first, and setting a ref node's identity
is the layer's privilege -- it is the friend that refs_fetch() uses for
exactly this.

No functional change.

Assisted-by: Claude-Code:claude-opus-5
src/bees-extent-layer.cc
src/bees-extent-tree.cc
src/bees-extent-tree.h