sdb icon indicating copy to clipboard operation
sdb copied to clipboard

btree walker doesn't work

Open ahrens opened this issue 2 years ago • 0 comments

Expected Behavior

sdb> echo 0xffff9b2e51316a18 | cast zfs_btree_t* | deref
(zfs_btree_t){
	.bt_compar = (int (*)(const void *, const void *))removal_block_compare+0x0 = 0xffffffffc03a57c0,
	.bt_find_in_buf = (bt_find_in_buf_f)zfs_btree_find_in_buf+0x0 = 0xffffffffc028bad0,
	.bt_elem_size = (size_t)8,
	.bt_leaf_size = (size_t)4096,
	.bt_leaf_cap = (uint32_t)510,
	.bt_height = (int32_t)2,
	.bt_num_elems = (uint64_t)262715,
	.bt_num_nodes = (uint64_t)968,
	.bt_root = (zfs_btree_hdr_t *)0xffff9b2fbe7ec000,
	.bt_bulk = (zfs_btree_leaf_t *)0x0,
}

walker should visit bt_num_elems = 262715 values Actual Behavior

sdb> echo 0xffff9b2e51316a18 | cast zfs_btree_t* | walk
(void *)0xffff9b37be7ec008
(void *)0xffff9b2fbe7ec010
(void *)0xffff9b2fbe7ec018
(void *)0xffff9b2fbe7ec020
(void *)0xffff9b2fbe7ec028
(void *)0xffff9b2fbe7ec030
(void *)0xffff9b2fbe7ec038
(void *)0xffff9b2fbe7ec040
(void *)0xffff9b2fbe7ec048
(void *)0xffff9b2fbe7ec050
(void *)0xffff9b2fbe7ec058
(void *)0xffff9b2fbe7ec060
(void *)0xffff9b2fbe7ec068
sdb> echo 0xffff9b2e51316a18 | cast zfs_btree_t* | walk | wc
(unsigned long long)13

Looks like maybe it's visiting the children of the root node?

sdb> echo 0xffff9b2e51316a18 | cast zfs_btree_t* | member bt_root | deref
(zfs_btree_hdr_t){
	.bth_parent = (struct zfs_btree_core *)0x0,
	.bth_first = (uint32_t)4294967295,
	.bth_count = (uint32_t)13,
}

ahrens avatar Jun 28 '23 17:06 ahrens