Lines Matching refs: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()
303 off = node->tree->node_size - 2; in hfs_bnode_dump()
310 if (node->tree->attributes & HFS_TREE_VARIDXKEYS || in hfs_bnode_dump()
311 node->tree->cnid == HFSPLUS_ATTR_CNID) in hfs_bnode_dump()
314 tmp = node->tree->max_key_len + 2; in hfs_bnode_dump()
330 struct hfs_btree *tree; in hfs_bnode_unlink() local
334 tree = node->tree; in hfs_bnode_unlink()
336 tmp = hfs_bnode_find(tree, node->prev); in hfs_bnode_unlink()
345 tree->leaf_head = node->next; in hfs_bnode_unlink()
348 tmp = hfs_bnode_find(tree, node->next); in hfs_bnode_unlink()
357 tree->leaf_tail = node->prev; in hfs_bnode_unlink()
363 tree->root = 0; in hfs_bnode_unlink()
364 tree->depth = 0; in hfs_bnode_unlink()
376 struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) in hfs_bnode_findhash() argument
380 if (cnid >= tree->node_count) { in hfs_bnode_findhash()
386 for (node = tree->node_hash[hfs_bnode_hash(cnid)]; in hfs_bnode_findhash()
393 static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) in __hfs_bnode_create() argument
401 if (cnid >= tree->node_count) { in __hfs_bnode_create()
407 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * in __hfs_bnode_create()
412 node->tree = tree; in __hfs_bnode_create()
417 node->tree->cnid, node->this); in __hfs_bnode_create()
419 spin_lock(&tree->hash_lock); in __hfs_bnode_create()
420 node2 = hfs_bnode_findhash(tree, cnid); in __hfs_bnode_create()
423 node->next_hash = tree->node_hash[hash]; in __hfs_bnode_create()
424 tree->node_hash[hash] = node; in __hfs_bnode_create()
425 tree->node_hash_cnt++; in __hfs_bnode_create()
427 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
433 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
435 mapping = tree->inode->i_mapping; in __hfs_bnode_create()
436 off = (loff_t)cnid << tree->node_size_shift; in __hfs_bnode_create()
439 for (i = 0; i < tree->pages_per_bnode; block++, i++) { in __hfs_bnode_create()
457 node->tree->cnid, node->this, atomic_read(&node->refcnt)); in hfs_bnode_unhash()
458 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; in hfs_bnode_unhash()
463 node->tree->node_hash_cnt--; in hfs_bnode_unhash()
467 struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num) in hfs_bnode_find() argument
474 spin_lock(&tree->hash_lock); in hfs_bnode_find()
475 node = hfs_bnode_findhash(tree, num); in hfs_bnode_find()
478 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
485 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
486 node = __hfs_bnode_create(tree, num); in hfs_bnode_find()
514 if (node->height <= 1 || node->height > tree->depth) in hfs_bnode_find()
521 rec_off = tree->node_size - 2; in hfs_bnode_find()
529 next_off > tree->node_size || in hfs_bnode_find()
556 for (i = 0; i < node->tree->pages_per_bnode; i++) in hfs_bnode_free()
562 struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) in hfs_bnode_create() argument
568 spin_lock(&tree->hash_lock); in hfs_bnode_create()
569 node = hfs_bnode_findhash(tree, num); in hfs_bnode_create()
570 spin_unlock(&tree->hash_lock); in hfs_bnode_create()
576 node = __hfs_bnode_create(tree, num); in hfs_bnode_create()
586 min_t(int, PAGE_SIZE, tree->node_size)); in hfs_bnode_create()
588 for (i = 1; i < tree->pages_per_bnode; i++) { in hfs_bnode_create()
603 node->tree->cnid, node->this, in hfs_bnode_get()
612 struct hfs_btree *tree = node->tree; in hfs_bnode_put() local
616 node->tree->cnid, node->this, in hfs_bnode_put()
619 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock)) in hfs_bnode_put()
621 for (i = 0; i < tree->pages_per_bnode; i++) { in hfs_bnode_put()
629 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
630 if (hfs_bnode_need_zeroout(tree)) in hfs_bnode_put()
631 hfs_bnode_clear(node, 0, tree->node_size); in hfs_bnode_put()
636 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
644 bool hfs_bnode_need_zeroout(struct hfs_btree *tree) in hfs_bnode_need_zeroout() argument
646 struct super_block *sb = tree->inode->i_sb; in hfs_bnode_need_zeroout()
650 return tree->cnid == HFSPLUS_CAT_CNID && in hfs_bnode_need_zeroout()