summaryrefslogtreecommitdiff
path: root/cmd/btrfs-dump-tree
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-04 22:53:09 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-04 22:53:09 -0600
commit67aab484a523dfcbf32f4fc68ace2474ade96a5f (patch)
tree64093a2d351b1b3c4a4b1612e39ee9de8a2bc7c4 /cmd/btrfs-dump-tree
parent02fccc8c29d6f638efee0302868242d805bd7711 (diff)
more
Diffstat (limited to 'cmd/btrfs-dump-tree')
-rw-r--r--cmd/btrfs-dump-tree/main.go33
1 files changed, 27 insertions, 6 deletions
diff --git a/cmd/btrfs-dump-tree/main.go b/cmd/btrfs-dump-tree/main.go
index 195d001..b87778b 100644
--- a/cmd/btrfs-dump-tree/main.go
+++ b/cmd/btrfs-dump-tree/main.go
@@ -118,8 +118,6 @@ func printTree(fs *btrfs.FS, root btrfs.LogicalAddr) error {
item.Head.DataOffset,
item.Head.DataSize)
switch body := item.Body.(type) {
- //case btrfsitem.UNTYPED_KEY:
- // // TODO
case btrfsitem.Inode:
fmt.Printf(""+
"\t\tgeneration %d transid %d size %d nbytes %d\n"+
@@ -204,10 +202,33 @@ func printTree(fs *btrfs.FS, root btrfs.LogicalAddr) error {
// fmt.Printf("\t\tfree space extent\n")
//case btrfsitem.FREE_SPACE_BITMAP_KEY:
// fmt.Printf("\t\tfree space bitmap\n")
- //case btrfsitem.CHUNK_ITEM_KEY:
- // // TODO(!)
- //case btrfsitem.DEV_ITEM_KEY:
- // // TODO
+ case btrfsitem.Chunk:
+ fmt.Printf("\t\tlength %d owner %d stripe_len %d type %v\n",
+ body.Size, body.Owner, body.StripeLen, body.Type)
+ fmt.Printf("\t\tio_align %d io_width %d sector_size %d\n",
+ body.IOOptimalAlign, body.IOOptimalWidth, body.IOMinSize)
+ fmt.Printf("\t\tnum_stripes %d sub_stripes %d\n",
+ body.NumStripes, body.SubStripes)
+ for i, stripe := range body.Stripes {
+ fmt.Printf("\t\t\tstripe %d devid %d offset %d\n",
+ i, stripe.DeviceID, stripe.Offset)
+ fmt.Printf("\t\t\tdev_uuid %s\n",
+ stripe.DeviceUUID)
+ }
+ case btrfsitem.Dev:
+ fmt.Printf(""+
+ "\t\tdevid %d total_bytes %d bytes_used %d\n"+
+ "\t\tio_align %d io_width %d sector_size %d type %d\n"+
+ "\t\tgeneration %d start_offset %d dev_group %d\n"+
+ "\t\tseek_speed %d bandwidth %d\n"+
+ "\t\tuuid %s\n"+
+ "\t\tfsid %s\n",
+ body.DeviceID, body.NumBytes, body.NumBytesUsed,
+ body.IOOptimalAlign, body.IOOptimalWidth, body.IOMinSize, body.Type,
+ body.Generation, body.StartOffset, body.DevGroup,
+ body.SeekSpeed, body.Bandwidth,
+ body.DevUUID,
+ body.FSUUID)
//case btrfsitem.DEV_EXTENT_KEY:
// // TODO
//case btrfsitem.QGROUP_STATUS_KEY: