summaryrefslogtreecommitdiff
path: root/cmd/btrfs-dump-tree
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-05 15:22:28 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-05 15:22:28 -0600
commitb4938aba1d890721cb6b2123fad9d81dfd156180 (patch)
treefacf483375c4fbacf85eb6be2961b21564ec8ff3 /cmd/btrfs-dump-tree
parente992b909f79ef5e8523052745207ba12c8b510a1 (diff)
So close!
Diffstat (limited to 'cmd/btrfs-dump-tree')
-rw-r--r--cmd/btrfs-dump-tree/main.go29
1 files changed, 27 insertions, 2 deletions
diff --git a/cmd/btrfs-dump-tree/main.go b/cmd/btrfs-dump-tree/main.go
index 2428a6c..f5eb6c7 100644
--- a/cmd/btrfs-dump-tree/main.go
+++ b/cmd/btrfs-dump-tree/main.go
@@ -217,8 +217,33 @@ func printTree(fs *btrfs.FS, root btrfs.LogicalAddr) error {
// // TODO
//case btrfsitem.EXTENT_CSUM_KEY:
// // TODO
- //case btrfsitem.EXTENT_DATA_KEY:
- // // TODO
+ case btrfsitem.FileExtent:
+ fmt.Printf("\t\tgeneration %d type %v\n",
+ body.Generation, body.Type)
+ switch body.Type {
+ case btrfsitem.FILE_EXTENT_INLINE:
+ fmt.Printf("\t\tinline extent data size %d ram_bytes %d compression %v\n",
+ len(body.BodyInline), body.RAMBytes, body.Compression)
+ case btrfsitem.FILE_EXTENT_PREALLOC:
+ fmt.Printf("\t\tprealloc data disk byte %d nr %d\n",
+ body.BodyPrealloc.DiskByteNr,
+ body.BodyPrealloc.DiskNumBytes)
+ fmt.Printf("\t\tprealloc data offset %d nr %d\n",
+ body.BodyPrealloc.Offset,
+ body.BodyPrealloc.NumBytes)
+ case btrfsitem.FILE_EXTENT_REG:
+ fmt.Printf("\t\textent data disk byte %d nr %d\n",
+ body.BodyReg.DiskByteNr,
+ body.BodyReg.DiskNumBytes)
+ fmt.Printf("\t\textenti data offset %d nr %d ram %d\n",
+ body.BodyReg.Offset,
+ body.BodyReg.NumBytes,
+ body.RAMBytes)
+ fmt.Printf("\t\textent compression %v\n",
+ body.Compression)
+ default:
+ fmt.Printf("\t\t(error) unknown file extent type %v", body.Type)
+ }
case btrfsitem.BlockGroup:
fmt.Printf("\t\tblock group used %d chunk_objectid %d flags %v\n",
body.Used, body.ChunkObjectID, body.Flags)