diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-30 15:11:31 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-30 15:15:12 -0600 |
commit | e3f0e61282d0190b9744c69ce69dcaeea22e6a3e (patch) | |
tree | 0b3ecf2951baa4745745524d8571f017b8dd85ac /lib | |
parent | beddf8b9e3a45c864bb4b00b7c4fef1e560d59eb (diff) |
btrfs: ReadableFS: Also embed btrfstree.NodeSource
Diffstat (limited to 'lib')
-rw-r--r-- | lib/btrfs/io3_btree.go | 8 | ||||
-rw-r--r-- | lib/btrfsutil/old_rebuilt_forrest.go | 10 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/btrfs/io3_btree.go b/lib/btrfs/io3_btree.go index 01797df..50736cf 100644 --- a/lib/btrfs/io3_btree.go +++ b/lib/btrfs/io3_btree.go @@ -92,11 +92,13 @@ var _ btrfstree.Forrest = (*FS)(nil) // ReadableFS ////////////////////////////////////////////////////////////////// type ReadableFS interface { - btrfstree.Forrest + Name() string - Superblock() (*btrfstree.Superblock, error) + // For reading btrees. + btrfstree.Forrest - Name() string + // For reading the superblock and raw nodes. + btrfstree.NodeSource // For reading file contents. diskio.ReaderAt[btrfsvol.LogicalAddr] diff --git a/lib/btrfsutil/old_rebuilt_forrest.go b/lib/btrfsutil/old_rebuilt_forrest.go index 91fa275..535aa94 100644 --- a/lib/btrfsutil/old_rebuilt_forrest.go +++ b/lib/btrfsutil/old_rebuilt_forrest.go @@ -461,6 +461,16 @@ func (bt *OldRebuiltForrest) Superblock() (*btrfstree.Superblock, error) { return bt.inner.Superblock() } +// AcquireNode implements btrfstree.NodeSource (and btrfs.ReadableFS). +func (bt *OldRebuiltForrest) AcquireNode(ctx context.Context, addr btrfsvol.LogicalAddr, exp btrfstree.NodeExpectations) (*btrfstree.Node, error) { + return bt.inner.AcquireNode(ctx, addr, exp) +} + +// ReleaseNode implements btrfstree.NodeSource (and btrfs.ReadableFS). +func (bt *OldRebuiltForrest) ReleaseNode(node *btrfstree.Node) { + bt.inner.ReleaseNode(node) +} + // ReadAt implements diskio.ReaderAt[btrfsvol.LogicalAddr] (and btrfs.ReadableFS). func (bt *OldRebuiltForrest) ReadAt(p []byte, off btrfsvol.LogicalAddr) (int, error) { return bt.inner.ReadAt(p, off) |