Lines Matching refs:tree
47 struct hfs_btree *tree; in hfs_bnode_read_key() local
50 tree = node->tree; in hfs_bnode_read_key()
52 tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_bnode_read_key()
55 key_len = tree->max_key_len + 1; in hfs_bnode_read_key()
100 struct hfs_btree *tree; in hfs_bnode_copy() local
106 tree = src_node->tree; in hfs_bnode_copy()
147 off = node->tree->node_size - 2; in hfs_bnode_dump()
154 if (node->tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_bnode_dump()
157 tmp = node->tree->max_key_len + 1; in hfs_bnode_dump()
174 struct hfs_btree *tree; in hfs_bnode_unlink() local
178 tree = node->tree; in hfs_bnode_unlink()
180 tmp = hfs_bnode_find(tree, node->prev); in hfs_bnode_unlink()
188 tree->leaf_head = node->next; in hfs_bnode_unlink()
191 tmp = hfs_bnode_find(tree, node->next); in hfs_bnode_unlink()
199 tree->leaf_tail = node->prev; in hfs_bnode_unlink()
206 tree->root = 0; in hfs_bnode_unlink()
207 tree->depth = 0; in hfs_bnode_unlink()
219 struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) in hfs_bnode_findhash() argument
223 if (cnid >= tree->node_count) { in hfs_bnode_findhash()
228 for (node = tree->node_hash[hfs_bnode_hash(cnid)]; in hfs_bnode_findhash()
237 static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) in __hfs_bnode_create() argument
246 if (cnid >= tree->node_count) { in __hfs_bnode_create()
251 sb = tree->inode->i_sb; in __hfs_bnode_create()
252 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * in __hfs_bnode_create()
257 node->tree = tree; in __hfs_bnode_create()
262 node->tree->cnid, node->this); in __hfs_bnode_create()
264 spin_lock(&tree->hash_lock); in __hfs_bnode_create()
265 node2 = hfs_bnode_findhash(tree, cnid); in __hfs_bnode_create()
268 node->next_hash = tree->node_hash[hash]; in __hfs_bnode_create()
269 tree->node_hash[hash] = node; in __hfs_bnode_create()
270 tree->node_hash_cnt++; in __hfs_bnode_create()
272 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
277 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
279 mapping = tree->inode->i_mapping; in __hfs_bnode_create()
280 off = (loff_t)cnid * tree->node_size; in __hfs_bnode_create()
283 for (i = 0; i < tree->pages_per_bnode; i++) { in __hfs_bnode_create()
305 node->tree->cnid, node->this, atomic_read(&node->refcnt)); in hfs_bnode_unhash()
306 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; in hfs_bnode_unhash()
311 node->tree->node_hash_cnt--; in hfs_bnode_unhash()
315 struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num) in hfs_bnode_find() argument
322 spin_lock(&tree->hash_lock); in hfs_bnode_find()
323 node = hfs_bnode_findhash(tree, num); in hfs_bnode_find()
326 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
332 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
333 node = __hfs_bnode_create(tree, num); in hfs_bnode_find()
360 if (node->height <= 1 || node->height > tree->depth) in hfs_bnode_find()
367 rec_off = tree->node_size - 2; in hfs_bnode_find()
375 next_off > tree->node_size || in hfs_bnode_find()
402 for (i = 0; i < node->tree->pages_per_bnode; i++) in hfs_bnode_free()
408 struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) in hfs_bnode_create() argument
414 spin_lock(&tree->hash_lock); in hfs_bnode_create()
415 node = hfs_bnode_findhash(tree, num); in hfs_bnode_create()
416 spin_unlock(&tree->hash_lock); in hfs_bnode_create()
422 node = __hfs_bnode_create(tree, num); in hfs_bnode_create()
432 min((int)PAGE_CACHE_SIZE, (int)tree->node_size)); in hfs_bnode_create()
435 for (i = 1; i < tree->pages_per_bnode; i++) { in hfs_bnode_create()
451 node->tree->cnid, node->this, in hfs_bnode_get()
460 struct hfs_btree *tree = node->tree; in hfs_bnode_put() local
464 node->tree->cnid, node->this, in hfs_bnode_put()
467 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock)) in hfs_bnode_put()
469 for (i = 0; i < tree->pages_per_bnode; i++) { in hfs_bnode_put()
477 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
482 spin_unlock(&tree->hash_lock); in hfs_bnode_put()