Lines Matching full:tree

30 		if (pagenum >= node->tree->pages_per_bnode)  in hfs_bnode_read()
60 struct hfs_btree *tree; in hfs_bnode_read_key() local
63 tree = node->tree; in hfs_bnode_read_key()
65 tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_bnode_read_key()
68 key_len = tree->max_key_len + 1; in hfs_bnode_read_key()
160 off = node->tree->node_size - 2; in hfs_bnode_dump()
167 if (node->tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_bnode_dump()
170 tmp = node->tree->max_key_len + 1; in hfs_bnode_dump()
187 struct hfs_btree *tree; in hfs_bnode_unlink() local
191 tree = node->tree; in hfs_bnode_unlink()
193 tmp = hfs_bnode_find(tree, node->prev); in hfs_bnode_unlink()
201 tree->leaf_head = node->next; in hfs_bnode_unlink()
204 tmp = hfs_bnode_find(tree, node->next); in hfs_bnode_unlink()
212 tree->leaf_tail = node->prev; in hfs_bnode_unlink()
219 tree->root = 0; in hfs_bnode_unlink()
220 tree->depth = 0; in hfs_bnode_unlink()
232 struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) in hfs_bnode_findhash() argument
236 if (cnid >= tree->node_count) { in hfs_bnode_findhash()
237 pr_err("request for non-existent node %d in B*Tree\n", cnid); in hfs_bnode_findhash()
241 for (node = tree->node_hash[hfs_bnode_hash(cnid)]; in hfs_bnode_findhash()
250 static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) in __hfs_bnode_create() argument
258 if (cnid >= tree->node_count) { in __hfs_bnode_create()
259 pr_err("request for non-existent node %d in B*Tree\n", cnid); in __hfs_bnode_create()
263 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * in __hfs_bnode_create()
268 node->tree = tree; in __hfs_bnode_create()
273 node->tree->cnid, node->this); in __hfs_bnode_create()
275 spin_lock(&tree->hash_lock); in __hfs_bnode_create()
276 node2 = hfs_bnode_findhash(tree, cnid); in __hfs_bnode_create()
279 node->next_hash = tree->node_hash[hash]; in __hfs_bnode_create()
280 tree->node_hash[hash] = node; in __hfs_bnode_create()
281 tree->node_hash_cnt++; in __hfs_bnode_create()
284 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
289 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
291 mapping = tree->inode->i_mapping; in __hfs_bnode_create()
292 off = (loff_t)cnid * tree->node_size; in __hfs_bnode_create()
295 for (i = 0; i < tree->pages_per_bnode; i++) { in __hfs_bnode_create()
313 node->tree->cnid, node->this, atomic_read(&node->refcnt)); in hfs_bnode_unhash()
314 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; in hfs_bnode_unhash()
319 node->tree->node_hash_cnt--; in hfs_bnode_unhash()
322 /* Load a particular node out of a tree */
323 struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num) in hfs_bnode_find() argument
330 spin_lock(&tree->hash_lock); in hfs_bnode_find()
331 node = hfs_bnode_findhash(tree, num); in hfs_bnode_find()
334 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
340 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
341 node = __hfs_bnode_create(tree, num); in hfs_bnode_find()
369 if (node->height <= 1 || node->height > tree->depth) in hfs_bnode_find()
376 rec_off = tree->node_size - 2; in hfs_bnode_find()
384 next_off > tree->node_size || in hfs_bnode_find()
411 for (i = 0; i < node->tree->pages_per_bnode; i++) in hfs_bnode_free()
417 struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) in hfs_bnode_create() argument
423 spin_lock(&tree->hash_lock); in hfs_bnode_create()
424 node = hfs_bnode_findhash(tree, num); in hfs_bnode_create()
425 spin_unlock(&tree->hash_lock); in hfs_bnode_create()
431 node = __hfs_bnode_create(tree, num); in hfs_bnode_create()
441 min((int)PAGE_SIZE, (int)tree->node_size)); in hfs_bnode_create()
443 for (i = 1; i < tree->pages_per_bnode; i++) { in hfs_bnode_create()
458 node->tree->cnid, node->this, in hfs_bnode_get()
467 struct hfs_btree *tree = node->tree; in hfs_bnode_put() local
471 node->tree->cnid, node->this, in hfs_bnode_put()
474 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock)) in hfs_bnode_put()
476 for (i = 0; i < tree->pages_per_bnode; i++) { in hfs_bnode_put()
484 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
489 spin_unlock(&tree->hash_lock); in hfs_bnode_put()