Lines Matching refs:tree
15 static int hfs_btree_inc_height(struct hfs_btree *tree);
23 dataoff = node->tree->node_size - (rec + 2) * 2; in hfs_brec_lenoff()
38 !(node->tree->attributes & HFS_TREE_VARIDXKEYS)) { in hfs_brec_keylen()
39 if (node->tree->attributes & HFS_TREE_BIGKEYS) in hfs_brec_keylen()
40 retval = node->tree->max_key_len + 2; in hfs_brec_keylen()
42 retval = node->tree->max_key_len + 1; in hfs_brec_keylen()
44 recoff = hfs_bnode_read_u16(node, node->tree->node_size - (rec + 1) * 2); in hfs_brec_keylen()
47 if (node->tree->attributes & HFS_TREE_BIGKEYS) { in hfs_brec_keylen()
49 if (retval > node->tree->max_key_len + 2) { in hfs_brec_keylen()
56 if (retval > node->tree->max_key_len + 1) { in hfs_brec_keylen()
68 struct hfs_btree *tree; in hfs_brec_insert() local
75 tree = fd->tree; in hfs_brec_insert()
77 if (!tree->root) in hfs_brec_insert()
78 hfs_btree_inc_height(tree); in hfs_brec_insert()
79 fd->bnode = hfs_bnode_find(tree, tree->leaf_head); in hfs_brec_insert()
94 end_rec_off = tree->node_size - (node->num_recs + 1) * 2; in hfs_brec_insert()
107 tree->leaf_count++; in hfs_brec_insert()
108 mark_inode_dirty(tree->inode); in hfs_brec_insert()
116 idx_rec_off = tree->node_size - (rec + 1) * 2; in hfs_brec_insert()
144 hfs_btree_inc_height(tree); in hfs_brec_insert()
145 new_node->parent = tree->root; in hfs_brec_insert()
147 fd->bnode = hfs_bnode_find(tree, new_node->parent); in hfs_brec_insert()
161 if (tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_brec_insert()
164 fd->search_key->key_len = tree->max_key_len; in hfs_brec_insert()
165 key_len = tree->max_key_len + 1; in hfs_brec_insert()
178 struct hfs_btree *tree; in hfs_brec_remove() local
182 tree = fd->tree; in hfs_brec_remove()
185 rec_off = tree->node_size - (fd->record + 2) * 2; in hfs_brec_remove()
186 end_off = tree->node_size - (node->num_recs + 1) * 2; in hfs_brec_remove()
189 tree->leaf_count--; in hfs_brec_remove()
190 mark_inode_dirty(tree->inode); in hfs_brec_remove()
198 parent = hfs_bnode_find(tree, node->parent); in hfs_brec_remove()
231 struct hfs_btree *tree; in hfs_bnode_split() local
237 tree = fd->tree; in hfs_bnode_split()
239 new_node = hfs_bmap_alloc(tree); in hfs_bnode_split()
252 next_node = hfs_bnode_find(tree, node->next); in hfs_bnode_split()
262 size = tree->node_size / 2 - node->num_recs * 2 - 14; in hfs_bnode_split()
263 old_rec_off = tree->node_size - 4; in hfs_bnode_split()
298 new_rec_off = tree->node_size - 2; in hfs_bnode_split()
337 } else if (node->this == tree->leaf_tail) { in hfs_bnode_split()
339 tree->leaf_tail = new_node->this; in hfs_bnode_split()
340 mark_inode_dirty(tree->inode); in hfs_bnode_split()
352 struct hfs_btree *tree; in hfs_brec_update_parent() local
358 tree = fd->tree; in hfs_brec_update_parent()
365 parent = hfs_bnode_find(tree, node->parent); in hfs_brec_update_parent()
373 if (tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_brec_update_parent()
376 fd->keylength = newkeylen = tree->max_key_len + 1; in hfs_brec_update_parent()
379 rec_off = tree->node_size - (rec + 2) * 2; in hfs_brec_update_parent()
380 end_rec_off = tree->node_size - (parent->num_recs + 1) * 2; in hfs_brec_update_parent()
395 rec_off = tree->node_size - (rec + 2) * 2; in hfs_brec_update_parent()
396 end_rec_off = tree->node_size - (parent->num_recs + 1) * 2; in hfs_brec_update_parent()
413 if (!(tree->attributes & HFS_TREE_VARIDXKEYS)) in hfs_brec_update_parent()
423 fd->bnode = hfs_bnode_find(tree, new_node->parent); in hfs_brec_update_parent()
448 static int hfs_btree_inc_height(struct hfs_btree *tree) in hfs_btree_inc_height() argument
456 if (tree->root) { in hfs_btree_inc_height()
457 node = hfs_bnode_find(tree, tree->root); in hfs_btree_inc_height()
461 new_node = hfs_bmap_alloc(tree); in hfs_btree_inc_height()
467 tree->root = new_node->this; in hfs_btree_inc_height()
468 if (!tree->depth) { in hfs_btree_inc_height()
469 tree->leaf_head = tree->leaf_tail = new_node->this; in hfs_btree_inc_height()
479 new_node->height = ++tree->depth; in hfs_btree_inc_height()
489 rec = tree->node_size - 2; in hfs_btree_inc_height()
494 node->parent = tree->root; in hfs_btree_inc_height()
496 tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_btree_inc_height()
499 key_size = tree->max_key_len + 1; in hfs_btree_inc_height()
502 if (!(tree->attributes & HFS_TREE_VARIDXKEYS)) { in hfs_btree_inc_height()
503 key_size = tree->max_key_len + 1; in hfs_btree_inc_height()
504 hfs_bnode_write_u8(new_node, 14, tree->max_key_len); in hfs_btree_inc_height()
516 mark_inode_dirty(tree->inode); in hfs_btree_inc_height()