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/btrfs/io1_pv.go | |
parent | 1b84ddb5c9f8f4f1654feb50b4086fdcd9be7597 (diff) |
tree-wide: Cache all calls to binstruct.StaticSize
Diffstat (limited to 'lib/btrfs/io1_pv.go')
-rw-r--r-- | lib/btrfs/io1_pv.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/btrfs/io1_pv.go b/lib/btrfs/io1_pv.go index 0e7cd9c..72d33f5 100644 --- a/lib/btrfs/io1_pv.go +++ b/lib/btrfs/io1_pv.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -28,11 +28,13 @@ var SuperblockAddrs = []btrfsvol.PhysicalAddr{ 0x40_0000_0000, // 256GiB } +var superblockSize = binstruct.StaticSize(btrfstree.Superblock{}) + func (dev *Device) Superblocks() ([]*diskio.Ref[btrfsvol.PhysicalAddr, btrfstree.Superblock], error) { if dev.cacheSuperblocks != nil { return dev.cacheSuperblocks, nil } - superblockSize := btrfsvol.PhysicalAddr(binstruct.StaticSize(btrfstree.Superblock{})) + superblockSize := btrfsvol.PhysicalAddr(superblockSize) sz := dev.Size() |