summaryrefslogtreecommitdiff
path: root/cmd/btrfs-rec/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/btrfs-rec/main.go')
-rw-r--r--cmd/btrfs-rec/main.go20
1 files changed, 7 insertions, 13 deletions
diff --git a/cmd/btrfs-rec/main.go b/cmd/btrfs-rec/main.go
index ad768de..e167095 100644
--- a/cmd/btrfs-rec/main.go
+++ b/cmd/btrfs-rec/main.go
@@ -49,10 +49,9 @@ var globalFlags struct {
logLevel textui.LogLevelFlag
pvs []string
- mappings string
- nodeList string
- rebuildV1 bool
- rebuildV2 bool
+ mappings string
+ nodeList string
+ rebuild bool
stopProfiling profile.StopFunc
@@ -102,11 +101,8 @@ func main() {
"load node list (output of 'btrfs-recs inspect [rebuild-mappings] list-nodes') from external JSON file `nodes.json`")
noError(argparser.MarkPersistentFlagFilename("node-list"))
- argparser.PersistentFlags().BoolVar(&globalFlags.rebuildV1, "rebuild", false,
- "attempt to rebuild broken btrees when reading (v1)")
-
- argparser.PersistentFlags().BoolVar(&globalFlags.rebuildV2, "rebuild-v2", false,
- "attempt to rebuild broken btrees when reading (v2)")
+ argparser.PersistentFlags().BoolVar(&globalFlags.rebuild, "rebuild", false,
+ "attempt to rebuild broken btrees when reading")
globalFlags.stopProfiling = profile.AddProfileFlags(argparser.PersistentFlags(), "profile.")
@@ -214,9 +210,7 @@ func runWithRawFSAndNodeList(runE func(*btrfs.FS, []btrfsvol.LogicalAddr, *cobra
func _runWithReadableFS(wantNodeList bool, runE func(btrfs.ReadableFS, []btrfsvol.LogicalAddr, *cobra.Command, []string) error) func(*cobra.Command, []string) error {
inner := func(fs *btrfs.FS, nodeList []btrfsvol.LogicalAddr, cmd *cobra.Command, args []string) error {
var rfs btrfs.ReadableFS = fs
- if globalFlags.rebuildV1 {
- rfs = btrfsutil.NewOldRebuiltForrest(fs)
- } else if globalFlags.rebuildV2 {
+ if globalFlags.rebuild {
ctx := cmd.Context()
graph, err := btrfsutil.ReadGraph(ctx, fs, nodeList)
@@ -231,7 +225,7 @@ func _runWithReadableFS(wantNodeList bool, runE func(btrfs.ReadableFS, []btrfsvo
}
return func(cmd *cobra.Command, args []string) error {
- if wantNodeList || globalFlags.rebuildV2 {
+ if wantNodeList || globalFlags.rebuild {
return runWithRawFSAndNodeList(inner)(cmd, args)
}
return runWithRawFS(func(fs *btrfs.FS, cmd *cobra.Command, args []string) error {