summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/btrfs-rec/inspect/rebuildmappings/process.go14
-rw-r--r--cmd/btrfs-rec/inspect/rebuildmappings/process_matchsums_fuzzy.go4
-rw-r--r--cmd/btrfs-rec/inspect/rebuildmappings/scan.go2
-rw-r--r--cmd/btrfs-rec/inspect/rebuildtrees/rebuild.go30
-rw-r--r--cmd/btrfs-rec/inspect/rebuildtrees/rebuild_wanttyp.go4
-rw-r--r--cmd/btrfs-rec/inspect/rebuildtrees/scan.go3
-rw-r--r--lib/btrfsutil/graph.go9
-rw-r--r--lib/btrfsutil/rebuilt_forrest.go2
-rw-r--r--lib/btrfsutil/rebuilt_tree.go8
-rw-r--r--lib/textui/log.go88
10 files changed, 87 insertions, 77 deletions
diff --git a/cmd/btrfs-rec/inspect/rebuildmappings/process.go b/cmd/btrfs-rec/inspect/rebuildmappings/process.go
index 4ef4dac..7ce3748 100644
--- a/cmd/btrfs-rec/inspect/rebuildmappings/process.go
+++ b/cmd/btrfs-rec/inspect/rebuildmappings/process.go
@@ -54,7 +54,7 @@ func RebuildMappings(ctx context.Context, fs *btrfs.FS, scanResults ScanDevicesR
dlog.Infof(ctx, "plan: 6/6 search for block groups in checksum map (fuzzy)")
_ctx := ctx
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.step", "1/6")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.step", "1/6")
dlog.Infof(_ctx, "1/6: Processing %d chunks...", numChunks)
for _, devID := range devIDs {
devResults := scanResults[devID]
@@ -68,7 +68,7 @@ func RebuildMappings(ctx context.Context, fs *btrfs.FS, scanResults ScanDevicesR
}
dlog.Info(_ctx, "... done processing chunks")
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.step", "2/6")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.step", "2/6")
dlog.Infof(_ctx, "2/6: Processing %d device extents...", numDevExts)
for _, devID := range devIDs {
devResults := scanResults[devID]
@@ -84,7 +84,7 @@ func RebuildMappings(ctx context.Context, fs *btrfs.FS, scanResults ScanDevicesR
// too much. (Because nodes are numerous and small, while the
// others are few and large; so it is likely that many of the
// nodes will be subsumed by other things.)
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.step", "3/6")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.step", "3/6")
dlog.Infof(_ctx, "3/6: Processing %d nodes...", numNodes)
for _, devID := range devIDs {
devResults := scanResults[devID]
@@ -109,7 +109,7 @@ func RebuildMappings(ctx context.Context, fs *btrfs.FS, scanResults ScanDevicesR
// Use block groups to add missing flags (and as a hint to
// combine node entries).
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.step", "4/6")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.step", "4/6")
dlog.Infof(_ctx, "4/6: Processing %d block groups...", numBlockGroups)
// First dedup them, because they change for allocations and
// CoW means that they'll bounce around a lot, so you likely
@@ -157,7 +157,7 @@ func RebuildMappings(ctx context.Context, fs *btrfs.FS, scanResults ScanDevicesR
// The fuzzy-search is only fast because the exact-search is so good at getting `physicalBlocks` down.
// Empirically: if I remove the exact-search step, then the fuzzy-match step is more than an order of magnitude
// slower.
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.step", "5/6")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.step", "5/6")
dlog.Infof(_ctx, "5/6: Searching for %d block groups in checksum map (exact)...", len(bgs))
physicalSums := ExtractPhysicalSums(scanResults)
logicalSums := ExtractLogicalSums(ctx, scanResults)
@@ -166,14 +166,14 @@ func RebuildMappings(ctx context.Context, fs *btrfs.FS, scanResults ScanDevicesR
}
dlog.Info(ctx, "... done searching for exact block groups")
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.step", "6/6")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.step", "6/6")
dlog.Infof(_ctx, "6/6: Searching for %d block groups in checksum map (fuzzy)...", len(bgs))
if err := matchBlockGroupSumsFuzzy(ctx, fs, bgs, physicalSums, logicalSums); err != nil {
return err
}
dlog.Info(_ctx, "... done searching for fuzzy block groups")
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.step", "report")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.step", "report")
dlog.Info(_ctx, "report:")
unmappedPhysicalRegions := ListUnmappedPhysicalRegions(fs)
diff --git a/cmd/btrfs-rec/inspect/rebuildmappings/process_matchsums_fuzzy.go b/cmd/btrfs-rec/inspect/rebuildmappings/process_matchsums_fuzzy.go
index d6ea338..00f367f 100644
--- a/cmd/btrfs-rec/inspect/rebuildmappings/process_matchsums_fuzzy.go
+++ b/cmd/btrfs-rec/inspect/rebuildmappings/process_matchsums_fuzzy.go
@@ -45,7 +45,7 @@ func matchBlockGroupSumsFuzzy(ctx context.Context,
) error {
_ctx := ctx
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.substep", "indexing")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.substep", "indexing")
dlog.Info(ctx, "Indexing physical regions...") // O(m)
regions := ListUnmappedPhysicalRegions(fs)
physicalIndex := make(map[btrfssum.ShortSum][]btrfsvol.QualifiedPhysicalAddr)
@@ -62,7 +62,7 @@ func matchBlockGroupSumsFuzzy(ctx context.Context,
}
dlog.Info(ctx, "... done indexing")
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-mappings.substep", "searching")
+ ctx = dlog.WithField(_ctx, "btrfs.inspect.rebuild-mappings.process.substep", "searching")
dlog.Info(ctx, "Searching...")
numBlockgroups := len(blockgroups)
for i, bgLAddr := range maps.SortedKeys(blockgroups) {
diff --git a/cmd/btrfs-rec/inspect/rebuildmappings/scan.go b/cmd/btrfs-rec/inspect/rebuildmappings/scan.go
index b67beaf..2128a48 100644
--- a/cmd/btrfs-rec/inspect/rebuildmappings/scan.go
+++ b/cmd/btrfs-rec/inspect/rebuildmappings/scan.go
@@ -110,7 +110,7 @@ var sbSize = btrfsvol.PhysicalAddr(binstruct.StaticSize(btrfstree.Superblock{}))
// ScanOneDevice mostly mimics btrfs-progs
// cmds/rescue-chunk-recover.c:scan_one_device().
func ScanOneDevice(ctx context.Context, dev *btrfs.Device, sb btrfstree.Superblock) (ScanOneDeviceResult, error) {
- ctx = dlog.WithField(ctx, "btrfsinspect.scandevices.dev", dev.Name())
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-mappings.scan.dev", dev.Name())
result := ScanOneDeviceResult{
FoundNodes: make(map[btrfsvol.LogicalAddr][]btrfsvol.PhysicalAddr),
diff --git a/cmd/btrfs-rec/inspect/rebuildtrees/rebuild.go b/cmd/btrfs-rec/inspect/rebuildtrees/rebuild.go
index 565cb06..bbfcdde 100644
--- a/cmd/btrfs-rec/inspect/rebuildtrees/rebuild.go
+++ b/cmd/btrfs-rec/inspect/rebuildtrees/rebuild.go
@@ -75,7 +75,7 @@ type Rebuilder interface {
}
func NewRebuilder(ctx context.Context, fs *btrfs.FS, nodeScanResults rebuildmappings.ScanDevicesResult) (Rebuilder, error) {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.step", "read-fs-data")
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.step", "read-fs-data")
sb, nodeGraph, keyIO, err := ScanDevices(ctx, fs, nodeScanResults) // ScanDevices does its own logging
if err != nil {
return nil, err
@@ -95,7 +95,7 @@ func (o *rebuilder) ListRoots(ctx context.Context) map[btrfsprim.ObjID]container
}
func (o *rebuilder) Rebuild(ctx context.Context) error {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.step", "rebuild")
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.step", "rebuild")
// Initialize
o.retryItemQueue = make(map[btrfsprim.ObjID]containers.Set[keyAndTree])
@@ -113,7 +113,7 @@ func (o *rebuilder) Rebuild(ctx context.Context) error {
// Run
for passNum := 0; len(o.treeQueue) > 0 || len(o.addedItemQueue) > 0 || len(o.settledItemQueue) > 0 || len(o.augmentQueue) > 0; passNum++ {
- ctx := dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.pass", passNum)
+ ctx := dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.pass", passNum)
// Crawl trees (Drain o.treeQueue, fill o.addedItemQueue).
if err := o.processTreeQueue(ctx); err != nil {
@@ -146,7 +146,7 @@ func (o *rebuilder) Rebuild(ctx context.Context) error {
// processTreeQueue drains o.treeQueue, filling o.addedItemQueue.
func (o *rebuilder) processTreeQueue(ctx context.Context) error {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.substep", "collect-items")
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.substep", "collect-items")
queue := maps.SortedKeys(o.treeQueue)
o.treeQueue = make(containers.Set[btrfsprim.ObjID])
@@ -180,7 +180,7 @@ func (s settleItemStats) String() string {
// processAddedItemQueue drains o.addedItemQueue, filling o.augmentQueue and o.settledItemQueue.
func (o *rebuilder) processAddedItemQueue(ctx context.Context) error {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.substep", "settle-items")
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.substep", "settle-items")
queue := maps.Keys(o.addedItemQueue)
o.addedItemQueue = make(containers.Set[keyAndTree])
@@ -191,13 +191,13 @@ func (o *rebuilder) processAddedItemQueue(ctx context.Context) error {
var progress settleItemStats
progress.D = len(queue)
progressWriter := textui.NewProgress[settleItemStats](ctx, dlog.LogLevelInfo, textui.Tunable(1*time.Second))
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.substep.progress", &progress)
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.substep.progress", &progress)
for i, key := range queue {
progress.N = i
progressWriter.Set(progress)
- ctx := dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.settle.item", key)
+ ctx := dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.settle.item", key)
tree := o.rebuilt.Tree(ctx, key.TreeID)
incPtr, ok := tree.Items(ctx).Load(key.Key)
if !ok {
@@ -239,7 +239,7 @@ func (s processItemStats) String() string {
// processSettledItemQueue drains o.settledItemQueue, filling o.augmentQueue and o.treeQueue.
func (o *rebuilder) processSettledItemQueue(ctx context.Context) error {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.substep", "process-items")
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.substep", "process-items")
queue := maps.Keys(o.settledItemQueue)
o.settledItemQueue = make(containers.Set[keyAndTree])
@@ -250,7 +250,7 @@ func (o *rebuilder) processSettledItemQueue(ctx context.Context) error {
var progress processItemStats
progress.D = len(queue)
progressWriter := textui.NewProgress[processItemStats](ctx, dlog.LogLevelInfo, textui.Tunable(1*time.Second))
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.substep.progress", &progress)
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.substep.progress", &progress)
type keyAndBody struct {
keyAndTree
@@ -264,7 +264,7 @@ func (o *rebuilder) processSettledItemQueue(ctx context.Context) error {
if err := ctx.Err(); err != nil {
return err
}
- ctx := dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.process.item", key)
+ ctx := dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.process.item", key)
item := keyAndBody{
keyAndTree: key,
Body: o.rebuilt.Tree(ctx, key.TreeID).ReadItem(ctx, key.Key),
@@ -280,7 +280,7 @@ func (o *rebuilder) processSettledItemQueue(ctx context.Context) error {
defer progressWriter.Done()
o.curKey.Key.OK = true
for item := range itemChan {
- ctx := dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.process.item", item.keyAndTree)
+ ctx := dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.process.item", item.keyAndTree)
o.curKey.TreeID = item.TreeID
o.curKey.Key.Val = item.Key
btrfscheck.HandleItem(o, ctx, item.TreeID, btrfstree.Item{
@@ -304,7 +304,7 @@ func (o *rebuilder) processSettledItemQueue(ctx context.Context) error {
// processAugmentQueue drains o.augmentQueue (and maybe o.retryItemQueue), filling o.addedItemQueue.
func (o *rebuilder) processAugmentQueue(ctx context.Context) error {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.substep", "apply-augments")
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.substep", "apply-augments")
resolvedAugments := make(map[btrfsprim.ObjID]containers.Set[btrfsvol.LogicalAddr], len(o.augmentQueue))
var progress textui.Portion[int]
@@ -312,7 +312,7 @@ func (o *rebuilder) processAugmentQueue(ctx context.Context) error {
if err := ctx.Err(); err != nil {
return err
}
- ctx := dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.augment.tree", treeID)
+ ctx := dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.augment.tree", treeID)
resolvedAugments[treeID] = o.resolveTreeAugments(ctx, treeID)
progress.D += len(resolvedAugments[treeID])
}
@@ -322,9 +322,9 @@ func (o *rebuilder) processAugmentQueue(ctx context.Context) error {
runtime.GC()
progressWriter := textui.NewProgress[textui.Portion[int]](ctx, dlog.LogLevelInfo, textui.Tunable(1*time.Second))
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.substep.progress", &progress)
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.substep.progress", &progress)
for _, treeID := range maps.SortedKeys(resolvedAugments) {
- ctx := dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.augment.tree", treeID)
+ ctx := dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.rebuild.augment.tree", treeID)
for _, nodeAddr := range maps.SortedKeys(resolvedAugments[treeID]) {
if err := ctx.Err(); err != nil {
progressWriter.Set(progress)
diff --git a/cmd/btrfs-rec/inspect/rebuildtrees/rebuild_wanttyp.go b/cmd/btrfs-rec/inspect/rebuildtrees/rebuild_wanttyp.go
index fa1ba98..a517579 100644
--- a/cmd/btrfs-rec/inspect/rebuildtrees/rebuild_wanttyp.go
+++ b/cmd/btrfs-rec/inspect/rebuildtrees/rebuild_wanttyp.go
@@ -96,8 +96,8 @@ func (o WantWithTree) String() string {
}
const (
- logFieldItemWant = "btrfsinspect.rebuild-nodes.rebuild.want"
- logFieldTreeWant = "btrfsinspect.rebuild-nodes.rebuild.add-tree.want"
+ logFieldItemWant = "btrfs.inspect.rebuild-trees.rebuild.want"
+ logFieldTreeWant = "btrfs.util.rebuilt-forrest.add-tree.want"
)
func withWant(ctx context.Context, logField, reason string, wantKey WantWithTree) context.Context {
diff --git a/cmd/btrfs-rec/inspect/rebuildtrees/scan.go b/cmd/btrfs-rec/inspect/rebuildtrees/scan.go
index 03261e0..2995a2e 100644
--- a/cmd/btrfs-rec/inspect/rebuildtrees/scan.go
+++ b/cmd/btrfs-rec/inspect/rebuildtrees/scan.go
@@ -32,7 +32,7 @@ func ScanDevices(ctx context.Context, fs *btrfs.FS, scanResults rebuildmappings.
var stats textui.Portion[int]
stats.D = countNodes(scanResults)
progressWriter := textui.NewProgress[textui.Portion[int]](
- dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.read.substep", "read-nodes"),
+ dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.read.substep", "read-nodes"),
dlog.LogLevelInfo, textui.Tunable(1*time.Second))
nodeGraph := btrfsutil.NewGraph(*sb)
@@ -67,6 +67,7 @@ func ScanDevices(ctx context.Context, fs *btrfs.FS, scanResults rebuildmappings.
progressWriter.Done()
dlog.Info(ctx, "... done reading node data")
+ ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.read.substep", "check")
if err := nodeGraph.FinalCheck(ctx, fs, *sb); err != nil {
return btrfstree.Superblock{}, btrfsutil.Graph{}, nil, err
}
diff --git a/lib/btrfsutil/graph.go b/lib/btrfsutil/graph.go
index b4a8b72..8debe9d 100644
--- a/lib/btrfsutil/graph.go
+++ b/lib/btrfsutil/graph.go
@@ -193,10 +193,8 @@ func (g Graph) InsertNode(nodeRef *diskio.Ref[btrfsvol.LogicalAddr, btrfstree.No
func (g Graph) FinalCheck(ctx context.Context, fs diskio.File[btrfsvol.LogicalAddr], sb btrfstree.Superblock) error {
var stats textui.Portion[int]
- _ctx := ctx
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-nodes.read.substep", "check-keypointers")
- dlog.Info(_ctx, "Checking keypointers for dead-ends...")
+ dlog.Info(ctx, "Checking keypointers for dead-ends...")
progressWriter := textui.NewProgress[textui.Portion[int]](ctx, dlog.LogLevelInfo, textui.Tunable(1*time.Second))
stats.D = len(g.EdgesTo)
progressWriter.Set(stats)
@@ -217,8 +215,7 @@ func (g Graph) FinalCheck(ctx context.Context, fs diskio.File[btrfsvol.LogicalAd
progressWriter.Done()
dlog.Info(ctx, "... done checking keypointers")
- ctx = dlog.WithField(_ctx, "btrfsinspect.rebuild-nodes.read.substep", "check-for-loops")
- dlog.Info(_ctx, "Checking for btree loops...")
+ dlog.Info(ctx, "Checking for btree loops...")
stats.D = len(g.Nodes)
stats.N = 0
progressWriter = textui.NewProgress[textui.Portion[int]](ctx, dlog.LogLevelInfo, textui.Tunable(1*time.Second))
@@ -255,7 +252,7 @@ func (g Graph) FinalCheck(ctx context.Context, fs diskio.File[btrfsvol.LogicalAd
if numLoops > 0 {
return fmt.Errorf("%d btree loops", numLoops)
}
- dlog.Info(_ctx, "... done checking for loops")
+ dlog.Info(ctx, "... done checking for loops")
return nil
}
diff --git a/lib/btrfsutil/rebuilt_forrest.go b/lib/btrfsutil/rebuilt_forrest.go
index 3dfb24c..70ece13 100644
--- a/lib/btrfsutil/rebuilt_forrest.go
+++ b/lib/btrfsutil/rebuilt_forrest.go
@@ -118,7 +118,7 @@ func (ts *RebuiltForrest) addTree(ctx context.Context, treeID btrfsprim.ObjID, s
}
}()
stack = append(stack, treeID)
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.add-tree", stack)
+ ctx = dlog.WithField(ctx, "btrfs.util.rebuilt-forrest.add-tree", stack)
dlog.Info(ctx, "adding tree...")
if slices.Contains(treeID, stack[:len(stack)-1]) {
dlog.Errorf(ctx, "failed to add tree: loop detected: %v", stack)
diff --git a/lib/btrfsutil/rebuilt_tree.go b/lib/btrfsutil/rebuilt_tree.go
index 2f6afbe..1009204 100644
--- a/lib/btrfsutil/rebuilt_tree.go
+++ b/lib/btrfsutil/rebuilt_tree.go
@@ -48,7 +48,7 @@ type RebuiltTree struct {
// .isOwnerOK, whether or not they're in the tree.
func (tree *RebuiltTree) leafToRoots(ctx context.Context) map[btrfsvol.LogicalAddr]containers.Set[btrfsvol.LogicalAddr] {
return containers.LoadOrElse[btrfsprim.ObjID, map[btrfsvol.LogicalAddr]containers.Set[btrfsvol.LogicalAddr]](&tree.forrest.leafs, tree.ID, func(btrfsprim.ObjID) map[btrfsvol.LogicalAddr]containers.Set[btrfsvol.LogicalAddr] {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.index-nodes", fmt.Sprintf("tree=%v", tree.ID))
+ ctx = dlog.WithField(ctx, "btrfs.util.rebuilt-tree.index-nodes", fmt.Sprintf("tree=%v", tree.ID))
nodeToRoots := make(map[btrfsvol.LogicalAddr]containers.Set[btrfsvol.LogicalAddr])
@@ -136,7 +136,7 @@ func (tree *RebuiltTree) isOwnerOK(owner btrfsprim.ObjID, gen btrfsprim.Generati
// Do not mutate the returned map; it is a pointer to the
// RebuiltTree's internal map!
func (tree *RebuiltTree) Items(ctx context.Context) *containers.SortedMap[btrfsprim.Key, ItemPtr] {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.index-inc-items", fmt.Sprintf("tree=%v", tree.ID))
+ ctx = dlog.WithField(ctx, "btrfs.util.rebuilt-tree.index-inc-items", fmt.Sprintf("tree=%v", tree.ID))
return tree.items(ctx, &tree.forrest.incItems, tree.Roots.HasAny)
}
@@ -146,7 +146,7 @@ func (tree *RebuiltTree) Items(ctx context.Context) *containers.SortedMap[btrfsp
// Do not mutate the returned map; it is a pointer to the
// RebuiltTree's internal map!
func (tree *RebuiltTree) PotentialItems(ctx context.Context) *containers.SortedMap[btrfsprim.Key, ItemPtr] {
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.index-exc-items", fmt.Sprintf("tree=%v", tree.ID))
+ ctx = dlog.WithField(ctx, "btrfs.util.rebuilt-tree.index-exc-items", fmt.Sprintf("tree=%v", tree.ID))
return tree.items(ctx, &tree.forrest.excItems,
func(roots containers.Set[btrfsvol.LogicalAddr]) bool {
return !tree.Roots.HasAny(roots)
@@ -267,7 +267,7 @@ func (s rootStats) String() string {
func (tree *RebuiltTree) AddRoot(ctx context.Context, rootNode btrfsvol.LogicalAddr) {
tree.mu.Lock()
defer tree.mu.Unlock()
- ctx = dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.add-root", fmt.Sprintf("tree=%v rootNode=%v", tree.ID, rootNode))
+ ctx = dlog.WithField(ctx, "btrfs.util.rebuilt-tree.add-root", fmt.Sprintf("tree=%v rootNode=%v", tree.ID, rootNode))
dlog.Info(ctx, "adding root...")
leafToRoots := tree.leafToRoots(ctx)
diff --git a/lib/textui/log.go b/lib/textui/log.go
index 2a6fdd4..0a10ef6 100644
--- a/lib/textui/log.go
+++ b/lib/textui/log.go
@@ -289,57 +289,59 @@ func fieldOrd(key string) int {
case "dexec.err":
return -95
- // btrfsinspect scandevices ////////////////////////////////////////////
- case "btrfsinspect.scandevices.dev":
+ // btrfs inspect rebuild-mappings scan /////////////////////////////////
+ case "btrfs.inspect.rebuild-mappings.scan.dev":
return -1
- // btrfsinspect rebuild-mappings ///////////////////////////////////////
- case "btrfsinspect.rebuild-mappings.step":
+ // btrfs inspect rebuild-mappings process //////////////////////////////
+ case "btrfs.inspect.rebuild-mappings.process.step":
return -2
- case "btrfsinspect.rebuild-mappings.substep":
+ case "btrfs.inspect.rebuild-mappings.process.substep":
return -1
- // btrfsinspect rebuild-nodes //////////////////////////////////////////
- case "btrfsinspect.rebuild-nodes.step":
+ // btrfs inspect rebuild-trees /////////////////////////////////////////
+ case "btrfs.inspect.rebuild-trees.step":
return -50
// step=read-fs-data
- case "btrfsinspect.rebuild-nodes.read.substep":
+ case "btrfs.inspect.rebuild-trees.read.substep":
return -1
// step=rebuild
- case "btrfsinspect.rebuild-nodes.rebuild.pass":
+ case "btrfs.inspect.rebuild-trees.rebuild.pass":
return -49
- case "btrfsinspect.rebuild-nodes.rebuild.substep":
+ case "btrfs.inspect.rebuild-trees.rebuild.substep":
return -48
- case "btrfsinspect.rebuild-nodes.rebuild.substep.progress":
+ case "btrfs.inspect.rebuild-trees.rebuild.substep.progress":
return -47
// step=rebuild, substep=collect-items (1/3)
// step=rebuild, substep=settle-items (2a/3)
- case "btrfsinspect.rebuild-nodes.rebuild.settle.item":
+ case "btrfs.inspect.rebuild-trees.rebuild.settle.item":
return -25
// step=rebuild, substep=process-items (2b/3)
- case "btrfsinspect.rebuild-nodes.rebuild.process.item":
+ case "btrfs.inspect.rebuild-trees.rebuild.process.item":
return -25
// step=rebuild, substep=apply-augments (3/3)
- case "btrfsinspect.rebuild-nodes.rebuild.augment.tree":
+ case "btrfs.inspect.rebuild-trees.rebuild.augment.tree":
return -25
// step=rebuild (any substep)
- case "btrfsinspect.rebuild-nodes.rebuild.want.key":
+ case "btrfs.inspect.rebuild-trees.rebuild.want.key":
return -9
- case "btrfsinspect.rebuild-nodes.rebuild.want.reason":
+ case "btrfs.inspect.rebuild-trees.rebuild.want.reason":
return -8
- case "btrfsinspect.rebuild-nodes.rebuild.add-tree":
+
+ // btrfsutil.RebuiltForrest ////////////////////////////////////////////
+ case "btrfs.util.rebuilt-forrest.add-tree":
return -7
- case "btrfsinspect.rebuild-nodes.rebuild.add-tree.want.key":
+ case "btrfs.util.rebuilt-forrest.add-tree.want.key":
return -6
- case "btrfsinspect.rebuild-nodes.rebuild.add-tree.want.reason":
+ case "btrfs.util.rebuilt-forrest.add-tree.want.reason":
return -5
- case "btrfsinspect.rebuild-nodes.rebuild.add-root":
+ case "btrfs.util.rebuilt-tree.add-root":
return -4
- case "btrfsinspect.rebuild-nodes.rebuild.index-inc-items":
+ case "btrfs.util.rebuilt-tree.index-inc-items":
return -3
- case "btrfsinspect.rebuild-nodes.rebuild.index-exc-items":
+ case "btrfs.util.rebuilt-tree.index-exc-items":
return -2
- case "btrfsinspect.rebuild-nodes.rebuild.index-nodes":
+ case "btrfs.util.rebuilt-tree.index-nodes":
return -1
// other ///////////////////////////////////////////////////////////////
@@ -398,27 +400,37 @@ func writeField(w io.Writer, key string, val any) {
case strings.HasSuffix(name, ".pass"):
fmt.Fprintf(w, "/pass-%s", valStr)
return
- case strings.HasSuffix(name, ".substep") && name != "btrfsinspect.rebuild-nodes.rebuild.add-tree.substep":
+ case strings.HasSuffix(name, ".substep") && name != "btrfs.util.rebuilt-forrest.add-tree.substep":
fmt.Fprintf(w, "/%s", valStr)
return
- case strings.HasPrefix(name, "btrfsinspect."):
- name = strings.TrimPrefix(name, "btrfsinspect.")
+ case strings.HasPrefix(name, "btrfs."):
+ name = strings.TrimPrefix(name, "btrfs.")
switch {
- case strings.HasPrefix(name, "scandevices."):
- name = strings.TrimPrefix(name, "scandevices.")
- case strings.HasPrefix(name, "rebuild-mappings."):
- name = strings.TrimPrefix(name, "rebuild-mappings.")
- case strings.HasPrefix(name, "rebuild-nodes."):
- name = strings.TrimPrefix(name, "rebuild-nodes.")
+ case strings.HasPrefix(name, "inspect."):
+ name = strings.TrimPrefix(name, "inspect.")
switch {
- case strings.HasPrefix(name, "read."):
- name = strings.TrimPrefix(name, "read.")
- case strings.HasPrefix(name, "rebuild."):
- name = strings.TrimPrefix(name, "rebuild.")
+ case strings.HasPrefix(name, "rebuild-mappings."):
+ name = strings.TrimPrefix(name, "rebuild-mappings.")
+ switch {
+ case strings.HasPrefix(name, "scan."):
+ name = strings.TrimPrefix(name, "scan.")
+ case strings.HasPrefix(name, "process."):
+ name = strings.TrimPrefix(name, "process.")
+ }
+ case strings.HasPrefix(name, "rebuild-trees."):
+ name = strings.TrimPrefix(name, "rebuild-trees.")
+ switch {
+ case strings.HasPrefix(name, "read."):
+ name = strings.TrimPrefix(name, "read.")
+ case strings.HasPrefix(name, "rebuild."):
+ name = strings.TrimPrefix(name, "rebuild.")
+ }
}
+ case strings.HasPrefix(name, "util.rebuilt-forrest."):
+ name = strings.TrimPrefix(name, "util.rebuilt-forrest.")
+ case strings.HasPrefix(name, "util.rebuilt-tree."):
+ name = strings.TrimPrefix(name, "util.rebuilt-tree.")
}
- case strings.HasPrefix(name, "btrfs."):
- name = strings.TrimPrefix(name, "btrfs.")
}
fmt.Fprintf(w, " %s=%s", name, valStr)