Lines Matching full:tree

59 	struct hfs_btree *tree;  in hfs_bnode_read_key()  local
62 tree = node->tree; in hfs_bnode_read_key()
64 tree->attributes & HFS_TREE_VARIDXKEYS || in hfs_bnode_read_key()
65 node->tree->cnid == HFSPLUS_ATTR_CNID) in hfs_bnode_read_key()
68 key_len = tree->max_key_len + 2; in hfs_bnode_read_key()
309 off = node->tree->node_size - 2; in hfs_bnode_dump()
316 if (node->tree->attributes & HFS_TREE_VARIDXKEYS || in hfs_bnode_dump()
317 node->tree->cnid == HFSPLUS_ATTR_CNID) in hfs_bnode_dump()
320 tmp = node->tree->max_key_len + 2; in hfs_bnode_dump()
336 struct hfs_btree *tree; in hfs_bnode_unlink() local
340 tree = node->tree; in hfs_bnode_unlink()
342 tmp = hfs_bnode_find(tree, node->prev); in hfs_bnode_unlink()
351 tree->leaf_head = node->next; in hfs_bnode_unlink()
354 tmp = hfs_bnode_find(tree, node->next); in hfs_bnode_unlink()
363 tree->leaf_tail = node->prev; in hfs_bnode_unlink()
369 tree->root = 0; in hfs_bnode_unlink()
370 tree->depth = 0; in hfs_bnode_unlink()
382 struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) in hfs_bnode_findhash() argument
386 if (cnid >= tree->node_count) { in hfs_bnode_findhash()
387 pr_err("request for non-existent node %d in B*Tree\n", in hfs_bnode_findhash()
392 for (node = tree->node_hash[hfs_bnode_hash(cnid)]; in hfs_bnode_findhash()
399 static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) in __hfs_bnode_create() argument
407 if (cnid >= tree->node_count) { in __hfs_bnode_create()
408 pr_err("request for non-existent node %d in B*Tree\n", in __hfs_bnode_create()
413 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * in __hfs_bnode_create()
418 node->tree = tree; in __hfs_bnode_create()
423 node->tree->cnid, node->this); in __hfs_bnode_create()
425 spin_lock(&tree->hash_lock); in __hfs_bnode_create()
426 node2 = hfs_bnode_findhash(tree, cnid); in __hfs_bnode_create()
429 node->next_hash = tree->node_hash[hash]; in __hfs_bnode_create()
430 tree->node_hash[hash] = node; in __hfs_bnode_create()
431 tree->node_hash_cnt++; in __hfs_bnode_create()
433 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
439 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
441 mapping = tree->inode->i_mapping; in __hfs_bnode_create()
442 off = (loff_t)cnid << tree->node_size_shift; in __hfs_bnode_create()
445 for (i = 0; i < tree->pages_per_bnode; block++, i++) { in __hfs_bnode_create()
463 node->tree->cnid, node->this, atomic_read(&node->refcnt)); in hfs_bnode_unhash()
464 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; in hfs_bnode_unhash()
469 node->tree->node_hash_cnt--; in hfs_bnode_unhash()
472 /* Load a particular node out of a tree */
473 struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num) in hfs_bnode_find() argument
480 spin_lock(&tree->hash_lock); in hfs_bnode_find()
481 node = hfs_bnode_findhash(tree, num); in hfs_bnode_find()
484 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
491 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
492 node = __hfs_bnode_create(tree, num); in hfs_bnode_find()
520 if (node->height <= 1 || node->height > tree->depth) in hfs_bnode_find()
527 rec_off = tree->node_size - 2; in hfs_bnode_find()
535 next_off > tree->node_size || in hfs_bnode_find()
562 for (i = 0; i < node->tree->pages_per_bnode; i++) in hfs_bnode_free()
568 struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) in hfs_bnode_create() argument
574 spin_lock(&tree->hash_lock); in hfs_bnode_create()
575 node = hfs_bnode_findhash(tree, num); in hfs_bnode_create()
576 spin_unlock(&tree->hash_lock); in hfs_bnode_create()
582 node = __hfs_bnode_create(tree, num); in hfs_bnode_create()
592 min_t(int, PAGE_SIZE, tree->node_size)); in hfs_bnode_create()
594 for (i = 1; i < tree->pages_per_bnode; i++) { in hfs_bnode_create()
609 node->tree->cnid, node->this, in hfs_bnode_get()
618 struct hfs_btree *tree = node->tree; in hfs_bnode_put() local
622 node->tree->cnid, node->this, in hfs_bnode_put()
625 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock)) in hfs_bnode_put()
627 for (i = 0; i < tree->pages_per_bnode; i++) { in hfs_bnode_put()
635 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
636 if (hfs_bnode_need_zeroout(tree)) in hfs_bnode_put()
637 hfs_bnode_clear(node, 0, tree->node_size); in hfs_bnode_put()
642 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
647 * Unused nodes have to be zeroed if this is the catalog tree and
650 bool hfs_bnode_need_zeroout(struct hfs_btree *tree) in hfs_bnode_need_zeroout() argument
652 struct super_block *sb = tree->inode->i_sb; in hfs_bnode_need_zeroout()
656 return tree->cnid == HFSPLUS_CAT_CNID && in hfs_bnode_need_zeroout()