diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-01 00:19:38 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-01 00:19:38 -0600 |
commit | 7d2d4ae383e02a03dec6aa60207e3a1dfa8e79a9 (patch) | |
tree | 5cbe78f32ae384eaae01352a6626bc83461677ff /cmd/btrfs-fsck/pass2.go | |
parent | aee0fa4cf09ef5af90e28441d673ce440e4c2c16 (diff) |
move dumb map and sort operations to util/generic.go
Also, the optimization of reversing the node list in pass1 isn't relevant
anymore now that I'm using rbtrees
Diffstat (limited to 'cmd/btrfs-fsck/pass2.go')
-rw-r--r-- | cmd/btrfs-fsck/pass2.go | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/cmd/btrfs-fsck/pass2.go b/cmd/btrfs-fsck/pass2.go index d496d13..acea740 100644 --- a/cmd/btrfs-fsck/pass2.go +++ b/cmd/btrfs-fsck/pass2.go @@ -3,7 +3,6 @@ package main import ( "fmt" iofs "io/fs" - "sort" "lukeshu.com/btrfs-tools/pkg/btrfs" "lukeshu.com/btrfs-tools/pkg/btrfsmisc" @@ -53,14 +52,7 @@ func pass2(fs *btrfs.FS, foundNodes map[btrfs.LogicalAddr]struct{}) { } } - var orphanedRootsOrdered []btrfs.LogicalAddr - for root := range orphanedRoots { - orphanedRootsOrdered = append(orphanedRootsOrdered, root) - } - sort.Slice(orphanedRootsOrdered, func(i, j int) bool { - return orphanedRootsOrdered[i] < orphanedRootsOrdered[j] - }) - for _, node := range orphanedRootsOrdered { + for _, node := range util.SortedMapKeys(orphanedRoots) { fmt.Printf("Pass 2: orphaned root: %v\n", node) } } |