diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-13 00:36:34 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-13 00:36:34 -0600 |
commit | 7df18a02a988086d940a011eafeb1b8d70775005 (patch) | |
tree | d0d3c39fa5d12dc5fcc8de2381b47667bc3cdbc0 /cmd/btrfs-fsck/pass2.go | |
parent | f1e8040bc33e9057bd7a756a09c431c3f0d86226 (diff) |
Have TreeWalk be cancelable
Diffstat (limited to 'cmd/btrfs-fsck/pass2.go')
-rw-r--r-- | cmd/btrfs-fsck/pass2.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd/btrfs-fsck/pass2.go b/cmd/btrfs-fsck/pass2.go index 78bd2e5..ef55d93 100644 --- a/cmd/btrfs-fsck/pass2.go +++ b/cmd/btrfs-fsck/pass2.go @@ -5,6 +5,7 @@ package main import ( + "context" "fmt" "git.lukeshu.com/btrfs-progs-ng/lib/btrfs" @@ -13,11 +14,11 @@ import ( "git.lukeshu.com/btrfs-progs-ng/lib/util" ) -func pass2(fs *btrfs.FS, foundNodes map[btrfsvol.LogicalAddr]struct{}) { +func pass2(ctx context.Context, fs *btrfs.FS, foundNodes map[btrfsvol.LogicalAddr]struct{}) { fmt.Printf("\nPass 2: orphaned nodes\n") visitedNodes := make(map[btrfsvol.LogicalAddr]struct{}) - btrfsutil.WalkAllTrees(fs, btrfsutil.WalkAllTreesHandler{ + btrfsutil.WalkAllTrees(ctx, fs, btrfsutil.WalkAllTreesHandler{ TreeWalkHandler: btrfs.TreeWalkHandler{ Node: func(path btrfs.TreePath, node *util.Ref[btrfsvol.LogicalAddr, btrfs.Node]) error { visitedNodes[node.Addr] = struct{}{} |