Skip to contentSkip to conversation

Btrfs-progs: debug-tree output tree/key type instead of id

PATCH New Shen Feng 1 participant 1 message Jan 7, 2009 Btrfs file system

lore
Share & tools
lore

Shen Feng

author
#0 lore raw

PATCH 1/1 Btrfs-progs: debug-tree output tree/key type instead of id

Hi,

I'm not sure if this patch is useful.
I developed it only for my personal using.

Make the tree name and key type output more readable.

---
 debug-tree.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++-----
 print-tree.c |   79 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 138 insertions(+), 13 deletions(-)
debug-tree.c +65 -7
index 885962b..53f8be4 100644
@@ -178,21 +178,79 @@ int main(int ac, char **av)
 			switch(found_key.objectid) {
 			case BTRFS_ROOT_TREE_OBJECTID:
 				if (!skip)
-					printf("root ");
+					printf("root");
+				break;
+			case BTRFS_EXTENT_TREE_OBJECTID:
+				skip = 0;
+				if (!extent_only)
+					printf("extent");
+				break;
+			case BTRFS_CHUNK_TREE_OBJECTID:
+				if (!skip) {
+					printf("chunk");
+				}
 				break;
 			case BTRFS_DEV_TREE_OBJECTID:
 				if (!skip) {
-					printf("device extent tree ");
+					printf("device");
 				}
 				break;
-			case BTRFS_EXTENT_TREE_OBJECTID:
-				skip = 0;
-				if (!extent_only)
-					printf("extent tree ");
+			case BTRFS_FS_TREE_OBJECTID:
+				if (!skip) {
+					printf("fs");
+				}
+				break;
+			case BTRFS_ROOT_TREE_DIR_OBJECTID:
+				if (!skip) {
+					printf("directory");
+				}
+				break;
+			case BTRFS_CSUM_TREE_OBJECTID:
+				if (!skip) {
+					printf("checksum");
+				}
+				break;
+			case BTRFS_ORPHAN_OBJECTID:
+				if (!skip) {
+					printf("orphan");
+				}
 				break;
+			case BTRFS_TREE_LOG_OBJECTID:
+				if (!skip) {
+					printf("log");
+				}
+				break;
+			case BTRFS_TREE_LOG_FIXUP_OBJECTID:
+				if (!skip) {
+					printf("log fixup");
+				}
+				break;
+			case BTRFS_TREE_RELOC_OBJECTID:
+				if (!skip) {
+					printf("reloc");
+				}
+				break;
+			case BTRFS_DATA_RELOC_TREE_OBJECTID:
+				if (!skip) {
+					printf("data reloc");
+				}
+				break;
+			case BTRFS_EXTENT_CSUM_OBJECTID:
+				if (!skip) {
+					printf("extent checksum");
+				}
+			case BTRFS_MULTIPLE_OBJECTIDS:
+				if (!skip) {
+					printf("multiple");
+				}
+				break;
+			default:
+				if (!skip) {
+					printf("file");
+				}
 			}
 			if (!skip && !extent_only) {
-				printf("tree %llu %u %llu\n",
+				printf(" tree (%llu %u %llu)\n",
 				       (unsigned long long)found_key.objectid,
 				       found_key.type,
 				       (unsigned long long)found_key.offset);
print-tree.c +73 -6

99 lines not on this page · raw message

Signature · 1 line
1.6.0.6