Lines Matching refs:tree

24 	bool is_valid = off < node->tree->node_size;  in is_bnode_offset_valid()
31 node->tree->node_size, off); in is_bnode_offset_valid()
45 node_size = node->tree->node_size; in check_and_correct_requested_length()
55 node->tree->node_size, off, len, new_len); in check_and_correct_requested_length()
77 node->tree->node_size, off, len); in hfs_bnode_read()
115 struct hfs_btree *tree; in hfs_bnode_read_key() local
118 tree = node->tree; in hfs_bnode_read_key()
120 tree->attributes & HFS_TREE_VARIDXKEYS || in hfs_bnode_read_key()
121 node->tree->cnid == HFSPLUS_ATTR_CNID) in hfs_bnode_read_key()
124 key_len = tree->max_key_len + 2; in hfs_bnode_read_key()
148 node->tree->node_size, off, len); in hfs_bnode_write()
190 node->tree->node_size, off, len); in hfs_bnode_clear()
401 off = node->tree->node_size - 2; in hfs_bnode_dump()
408 if (node->tree->attributes & HFS_TREE_VARIDXKEYS || in hfs_bnode_dump()
409 node->tree->cnid == HFSPLUS_ATTR_CNID) in hfs_bnode_dump()
412 tmp = node->tree->max_key_len + 2; in hfs_bnode_dump()
428 struct hfs_btree *tree; in hfs_bnode_unlink() local
432 tree = node->tree; in hfs_bnode_unlink()
434 tmp = hfs_bnode_find(tree, node->prev); in hfs_bnode_unlink()
443 tree->leaf_head = node->next; in hfs_bnode_unlink()
446 tmp = hfs_bnode_find(tree, node->next); in hfs_bnode_unlink()
455 tree->leaf_tail = node->prev; in hfs_bnode_unlink()
461 tree->root = 0; in hfs_bnode_unlink()
462 tree->depth = 0; in hfs_bnode_unlink()
474 struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) in hfs_bnode_findhash() argument
478 if (cnid >= tree->node_count) { in hfs_bnode_findhash()
484 for (node = tree->node_hash[hfs_bnode_hash(cnid)]; in hfs_bnode_findhash()
491 static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) in __hfs_bnode_create() argument
499 if (cnid >= tree->node_count) { in __hfs_bnode_create()
505 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * in __hfs_bnode_create()
510 node->tree = tree; in __hfs_bnode_create()
515 node->tree->cnid, node->this); in __hfs_bnode_create()
517 spin_lock(&tree->hash_lock); in __hfs_bnode_create()
518 node2 = hfs_bnode_findhash(tree, cnid); in __hfs_bnode_create()
521 node->next_hash = tree->node_hash[hash]; in __hfs_bnode_create()
522 tree->node_hash[hash] = node; in __hfs_bnode_create()
523 tree->node_hash_cnt++; in __hfs_bnode_create()
525 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
531 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
533 mapping = tree->inode->i_mapping; in __hfs_bnode_create()
534 off = (loff_t)cnid << tree->node_size_shift; in __hfs_bnode_create()
537 for (i = 0; i < tree->pages_per_bnode; block++, i++) { in __hfs_bnode_create()
555 node->tree->cnid, node->this, atomic_read(&node->refcnt)); in hfs_bnode_unhash()
556 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; in hfs_bnode_unhash()
561 node->tree->node_hash_cnt--; in hfs_bnode_unhash()
565 struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num) in hfs_bnode_find() argument
572 spin_lock(&tree->hash_lock); in hfs_bnode_find()
573 node = hfs_bnode_findhash(tree, num); in hfs_bnode_find()
576 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
583 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
584 node = __hfs_bnode_create(tree, num); in hfs_bnode_find()
612 if (node->height <= 1 || node->height > tree->depth) in hfs_bnode_find()
619 rec_off = tree->node_size - 2; in hfs_bnode_find()
627 next_off > tree->node_size || in hfs_bnode_find()
654 for (i = 0; i < node->tree->pages_per_bnode; i++) in hfs_bnode_free()
660 struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) in hfs_bnode_create() argument
666 spin_lock(&tree->hash_lock); in hfs_bnode_create()
667 node = hfs_bnode_findhash(tree, num); in hfs_bnode_create()
668 spin_unlock(&tree->hash_lock); in hfs_bnode_create()
674 node = __hfs_bnode_create(tree, num); in hfs_bnode_create()
684 min_t(int, PAGE_SIZE, tree->node_size)); in hfs_bnode_create()
686 for (i = 1; i < tree->pages_per_bnode; i++) { in hfs_bnode_create()
701 node->tree->cnid, node->this, in hfs_bnode_get()
710 struct hfs_btree *tree = node->tree; in hfs_bnode_put() local
714 node->tree->cnid, node->this, in hfs_bnode_put()
717 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock)) in hfs_bnode_put()
719 for (i = 0; i < tree->pages_per_bnode; i++) { in hfs_bnode_put()
727 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
728 if (hfs_bnode_need_zeroout(tree)) in hfs_bnode_put()
729 hfs_bnode_clear(node, 0, tree->node_size); in hfs_bnode_put()
734 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
742 bool hfs_bnode_need_zeroout(struct hfs_btree *tree) in hfs_bnode_need_zeroout() argument
744 struct super_block *sb = tree->inode->i_sb; in hfs_bnode_need_zeroout()
748 return tree->cnid == HFSPLUS_CAT_CNID && in hfs_bnode_need_zeroout()