summaryrefslogtreecommitdiff
path: root/lib/btrfsprogs/btrfsinspect/scandevices.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-08-18 01:12:13 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-08-18 01:55:55 -0600
commitee0d8981e501c86774f3ec45466d3273464921e8 (patch)
tree4ae03e4ee5293ca99e7fc9bd8393d810766d90b0 /lib/btrfsprogs/btrfsinspect/scandevices.go
parent286db83409b56de7b0ac3a74709018c01de43f44 (diff)
Get inspect-scandevices to a decent-ish place
Diffstat (limited to 'lib/btrfsprogs/btrfsinspect/scandevices.go')
-rw-r--r--lib/btrfsprogs/btrfsinspect/scandevices.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/scandevices.go b/lib/btrfsprogs/btrfsinspect/scandevices.go
index 1f1ba80..b0ec0ff 100644
--- a/lib/btrfsprogs/btrfsinspect/scandevices.go
+++ b/lib/btrfsprogs/btrfsinspect/scandevices.go
@@ -22,7 +22,7 @@ import (
type ScanDevicesResult map[btrfsvol.DeviceID]ScanOneDeviceResult
-func ScanDevices(ctx context.Context, fs *btrfs.FS, sb btrfs.Superblock) (ScanDevicesResult, error) {
+func ScanDevices(ctx context.Context, fs *btrfs.FS) (ScanDevicesResult, error) {
grp := dgroup.NewGroup(ctx, dgroup.GroupConfig{})
var mu sync.Mutex
result := make(map[btrfsvol.DeviceID]ScanOneDeviceResult)
@@ -30,7 +30,11 @@ func ScanDevices(ctx context.Context, fs *btrfs.FS, sb btrfs.Superblock) (ScanDe
id := id
dev := dev
grp.Go(dev.Name(), func(ctx context.Context) error {
- devResult, err := ScanOneDevice(ctx, dev, sb)
+ sb, err := dev.Superblock()
+ if err != nil {
+ return err
+ }
+ devResult, err := ScanOneDevice(ctx, dev, *sb)
if err != nil {
return err
}