btrfs-progs: print-tree: Print offset as tree objectid for ROOT_ITEM
For cases like reloc trees and subvolume trees, their key offset is the tree id. The key will be printed as: (TREE_RELOC ROOT_ITEM 18446744073709551607) The negative number is long and even guys with real engineer brains can't easily get the meaning. This patch will change the output format to: (TREE_RELOC ROOT_ITEM DATA_RELOC_TREE) While for special offset value like 0 or (u64)-1, it's still shown as is. Signed-off-by: Qu Wenruo <wqu@suse.com> [ reword comment ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
aaf2dac5ef
commit
8c36786c81
11
print-tree.c
11
print-tree.c
|
@ -794,6 +794,17 @@ void btrfs_print_key(struct btrfs_disk_key *disk_key)
|
||||||
case BTRFS_UUID_KEY_RECEIVED_SUBVOL:
|
case BTRFS_UUID_KEY_RECEIVED_SUBVOL:
|
||||||
printf(" 0x%016llx)", (unsigned long long)offset);
|
printf(" 0x%016llx)", (unsigned long long)offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Key offsets of ROOT_ITEM point to tree root, print them in human
|
||||||
|
* readable format. Especially useful for trees like data/tree reloc
|
||||||
|
* tree, whose tree id can be negative.
|
||||||
|
*/
|
||||||
|
case BTRFS_ROOT_ITEM_KEY:
|
||||||
|
printf(" ");
|
||||||
|
print_objectid(stdout, offset, type);
|
||||||
|
printf(")");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (offset == (u64)-1)
|
if (offset == (u64)-1)
|
||||||
printf(" -1)");
|
printf(" -1)");
|
||||||
|
|
Loading…
Reference in New Issue