diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-29 21:44:40 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-30 21:29:20 -0600 |
commit | 03bd0222a8ef360c332f78f9e6a3762bde0aea58 (patch) | |
tree | 21c16e0c016ebe489e1543a7752ac0cd71492304 /lib/btrfsprogs/btrfsinspect/rebuildnodes | |
parent | 1b9df7b6a6bd03461a1ce48f70894994aa3db9b3 (diff) |
wip
Diffstat (limited to 'lib/btrfsprogs/btrfsinspect/rebuildnodes')
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go b/lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go index 2448033..3fc361c 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go @@ -86,8 +86,7 @@ func lostAndFoundNodes(ctx context.Context, fs _FS, nodeScanResults btrfsinspect if orphanedNodes[potentialRoot] > 1 { continue } - walkCtx, cancel := context.WithCancel(ctx) - walkFromNode(walkCtx, fs, potentialRoot, + walkFromNode(ctx, fs, potentialRoot, func(err *btrfstree.TreeError) { // do nothing }, @@ -97,11 +96,11 @@ func lostAndFoundNodes(ctx context.Context, fs _FS, nodeScanResults btrfsinspect if nodeAddr != potentialRoot { delete(orphanedRoots, nodeAddr) } - visitCnt := orphanedNodes[nodeAddr] + 1 - orphanedNodes[nodeAddr] = visitCnt - if visitCnt > 1 { - cancel() + visitCnt, ok := orphanedNodes[nodeAddr] + if visitCnt > 0 || !ok { + return iofs.SkipDir } + orphanedNodes[nodeAddr] = visitCnt + 1 return nil }, }, |