diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-04 01:11:17 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-12 16:16:53 -0700 |
commit | 6d62529a4badae01b4b1c22dbf3f0e462a908a0b (patch) | |
tree | 0601702b58a86739de67dae088fe5d372358d413 /lib/btrfsprogs/btrfsinspect/scandevices.go | |
parent | 1b84ddb5c9f8f4f1654feb50b4086fdcd9be7597 (diff) |
tree-wide: Cache all calls to binstruct.StaticSize
Diffstat (limited to 'lib/btrfsprogs/btrfsinspect/scandevices.go')
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/scandevices.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/scandevices.go b/lib/btrfsprogs/btrfsinspect/scandevices.go index 91b5136..0cfee5b 100644 --- a/lib/btrfsprogs/btrfsinspect/scandevices.go +++ b/lib/btrfsprogs/btrfsinspect/scandevices.go @@ -105,6 +105,8 @@ func (s scanStats) String() string { s.NumFoundExtentCSums) } +var sbSize = btrfsvol.PhysicalAddr(binstruct.StaticSize(btrfstree.Superblock{})) + // ScanOneDevice mostly mimics btrfs-progs // cmds/rescue-chunk-recover.c:scan_one_device(). func ScanOneDevice(ctx context.Context, dev *btrfs.Device, sb btrfstree.Superblock) (ScanOneDeviceResult, error) { @@ -114,8 +116,6 @@ func ScanOneDevice(ctx context.Context, dev *btrfs.Device, sb btrfstree.Superblo FoundNodes: make(map[btrfsvol.LogicalAddr][]btrfsvol.PhysicalAddr), } - sbSize := btrfsvol.PhysicalAddr(binstruct.StaticSize(btrfstree.Superblock{})) - devSize := dev.Size() if sb.NodeSize < sb.SectorSize { return result, fmt.Errorf("node_size(%v) < sector_size(%v)", |