diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-18 13:01:49 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-30 10:06:52 -0600 |
commit | 537800d21ae5dd4b95364457ab46d6403bb27f16 (patch) | |
tree | 376e420dc3f4e5a7221f9ad6cb8715aedd068d71 | |
parent | 87e107c3a5ed5793609ef8cc7c0f43209026902d (diff) |
btrfs: Fuss with indentation in prep for the next commit
-rw-r--r-- | lib/btrfs/io2_lv.go | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/lib/btrfs/io2_lv.go b/lib/btrfs/io2_lv.go index 44378a0..40fa8e9 100644 --- a/lib/btrfs/io2_lv.go +++ b/lib/btrfs/io2_lv.go @@ -162,33 +162,28 @@ func (fs *FS) initDev(ctx context.Context, sb btrfstree.Superblock) error { } } var errs derror.MultiError - fs.TreeWalk(ctx, btrfsprim.CHUNK_TREE_OBJECTID, - func(err *btrfstree.TreeError) { - errs = append(errs, err) - }, - btrfstree.TreeWalkHandler{ - Item: func(_ btrfstree.Path, item btrfstree.Item) { - if item.Key.ItemType != btrfsitem.CHUNK_ITEM_KEY { - return - } - switch itemBody := item.Body.(type) { - case *btrfsitem.Chunk: - for _, mapping := range itemBody.Mappings(item.Key) { - if err := fs.LV.AddMapping(mapping); err != nil { - errs = append(errs, err) - } - } - case *btrfsitem.Error: - // do nothing - default: - // This is a panic because the item decoder should not emit CHUNK_ITEM items as - // anything but btrfsitem.Chunk or btrfsitem.Error without this code also being - // updated. - panic(fmt.Errorf("should not happen: CHUNK_ITEM has unexpected item type: %T", itemBody)) + fs.TreeWalk(ctx, btrfsprim.CHUNK_TREE_OBJECTID, func(err *btrfstree.TreeError) { + errs = append(errs, err) + }, btrfstree.TreeWalkHandler{Item: func(_ btrfstree.Path, item btrfstree.Item) { + if item.Key.ItemType != btrfsitem.CHUNK_ITEM_KEY { + return + } + switch itemBody := item.Body.(type) { + case *btrfsitem.Chunk: + for _, mapping := range itemBody.Mappings(item.Key) { + if err := fs.LV.AddMapping(mapping); err != nil { + errs = append(errs, err) } - }, - }, - ) + } + case *btrfsitem.Error: + // do nothing + default: + // This is a panic because the item decoder should not emit CHUNK_ITEM items as + // anything but btrfsitem.Chunk or btrfsitem.Error without this code also being + // updated. + panic(fmt.Errorf("should not happen: CHUNK_ITEM has unexpected item type: %T", itemBody)) + } + }}) if len(errs) > 0 { return errs } |