From e1c2606daa740d70efc4e1bfade0513708ceed65 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 15 Jul 2022 21:13:46 -0600 Subject: Let btree search have access to the item size --- lib/btrfs/types_node.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/btrfs/types_node.go') diff --git a/lib/btrfs/types_node.go b/lib/btrfs/types_node.go index 781b2fa..840236d 100644 --- a/lib/btrfs/types_node.go +++ b/lib/btrfs/types_node.go @@ -247,8 +247,9 @@ func (node *Node) marshalInternalTo(bodyBuf []byte) error { // Node: "leaf" //////////////////////////////////////////////////////////////////////////////////// type Item struct { - Key Key - Body btrfsitem.Item + Key Key + BodySize uint32 // [ignored-when-writing] + Body btrfsitem.Item } type ItemHeader struct { @@ -287,8 +288,9 @@ func (node *Node) unmarshalLeaf(bodyBuf []byte) (int, error) { dataBuf := bodyBuf[dataOff : dataOff+dataSize] node.BodyLeaf = append(node.BodyLeaf, Item{ - Key: itemHead.Key, - Body: btrfsitem.UnmarshalItem(itemHead.Key, node.ChecksumType, dataBuf), + Key: itemHead.Key, + BodySize: itemHead.DataSize, + Body: btrfsitem.UnmarshalItem(itemHead.Key, node.ChecksumType, dataBuf), }) } -- cgit v1.2.3-2-g168b