From b4938aba1d890721cb6b2123fad9d81dfd156180 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 5 Jun 2022 15:22:28 -0600 Subject: So close! --- cmd/btrfs-dump-tree/main.go | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'cmd/btrfs-dump-tree') 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) -- cgit v1.2.3-2-g168b