Question about dump-tree
We debug mkfs.btrfs and print the extent tree item information
and use btrfs inspect-internal dump-tree 1.img to output the extent tree item .
But debug info not matched with dump-tree why this happen ?
Here is the diff
wjduan@linx:~/project/btrfs-progs$ git diff
diff --git a/mkfs/common.c b/mkfs/common.c
index bb5a2ad4..7b9657ee 100644
--- a/mkfs/common.c
+++ b/mkfs/common.c
@@ -551,6 +551,9 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg)
btrfs_set_item_key(buf, &disk_key, nritems);
btrfs_set_item_offset(buf, nritems, itemoff);
btrfs_set_item_size(buf, nritems, item_size);
+ printf("offset of extent_item :%ld,item_size :%d\n",itemoff,item_size);
+
+
extent_item = btrfs_item_ptr(buf, nritems,
struct btrfs_extent_item);
btrfs_set_extent_refs(buf, extent_item, 1);
The output:
offset of extent_item :16259,item_size :24
offset of extent_item :16211,item_size :24
offset of extent_item :16187,item_size :24
offset of extent_item :16163,item_size :24
offset of extent_item :16139,item_size :24
offset of extent_item :16115,item_size :24
offset of extent_item :16091,item_size :24
Please improve the wording. It's very hard to understand what you're really saying.
I can only guess what you want to say, make_btrfs() is the temporary fs utilized by mkfs, not the end result of the final fs, thus no wonder the extent tree in the final fs differs from the temporary one.
I think you understood it right. The code change is in the big loop in make_btrfs which creates the initial tree structures. At this time the signature magic (!BHRfS_M) is not the final one (_BHRfS_M) so various tools may refuse to read the filesystem or report errors.