Lines Matching full:tree
48 struct hfs_btree *tree; in hfs_bnode_read_key() local
51 tree = node->tree; in hfs_bnode_read_key()
53 tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_bnode_read_key()
56 key_len = tree->max_key_len + 1; in hfs_bnode_read_key()
146 off = node->tree->node_size - 2; in hfs_bnode_dump()
153 if (node->tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_bnode_dump()
156 tmp = node->tree->max_key_len + 1; in hfs_bnode_dump()
173 struct hfs_btree *tree; in hfs_bnode_unlink() local
177 tree = node->tree; in hfs_bnode_unlink()
179 tmp = hfs_bnode_find(tree, node->prev); in hfs_bnode_unlink()
187 tree->leaf_head = node->next; in hfs_bnode_unlink()
190 tmp = hfs_bnode_find(tree, node->next); in hfs_bnode_unlink()
198 tree->leaf_tail = node->prev; in hfs_bnode_unlink()
205 tree->root = 0; in hfs_bnode_unlink()
206 tree->depth = 0; in hfs_bnode_unlink()
218 struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) in hfs_bnode_findhash() argument
222 if (cnid >= tree->node_count) { in hfs_bnode_findhash()
223 pr_err("request for non-existent node %d in B*Tree\n", cnid); in hfs_bnode_findhash()
227 for (node = tree->node_hash[hfs_bnode_hash(cnid)]; in hfs_bnode_findhash()
236 static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) in __hfs_bnode_create() argument
244 if (cnid >= tree->node_count) { in __hfs_bnode_create()
245 pr_err("request for non-existent node %d in B*Tree\n", cnid); in __hfs_bnode_create()
249 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * in __hfs_bnode_create()
254 node->tree = tree; in __hfs_bnode_create()
259 node->tree->cnid, node->this); in __hfs_bnode_create()
261 spin_lock(&tree->hash_lock); in __hfs_bnode_create()
262 node2 = hfs_bnode_findhash(tree, cnid); in __hfs_bnode_create()
265 node->next_hash = tree->node_hash[hash]; in __hfs_bnode_create()
266 tree->node_hash[hash] = node; in __hfs_bnode_create()
267 tree->node_hash_cnt++; in __hfs_bnode_create()
269 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
274 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
276 mapping = tree->inode->i_mapping; in __hfs_bnode_create()
277 off = (loff_t)cnid * tree->node_size; in __hfs_bnode_create()
280 for (i = 0; i < tree->pages_per_bnode; i++) { in __hfs_bnode_create()
302 node->tree->cnid, node->this, atomic_read(&node->refcnt)); in hfs_bnode_unhash()
303 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; in hfs_bnode_unhash()
308 node->tree->node_hash_cnt--; in hfs_bnode_unhash()
311 /* Load a particular node out of a tree */
312 struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num) in hfs_bnode_find() argument
319 spin_lock(&tree->hash_lock); in hfs_bnode_find()
320 node = hfs_bnode_findhash(tree, num); in hfs_bnode_find()
323 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
329 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
330 node = __hfs_bnode_create(tree, num); in hfs_bnode_find()
357 if (node->height <= 1 || node->height > tree->depth) in hfs_bnode_find()
364 rec_off = tree->node_size - 2; in hfs_bnode_find()
372 next_off > tree->node_size || in hfs_bnode_find()
399 for (i = 0; i < node->tree->pages_per_bnode; i++) in hfs_bnode_free()
405 struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) in hfs_bnode_create() argument
411 spin_lock(&tree->hash_lock); in hfs_bnode_create()
412 node = hfs_bnode_findhash(tree, num); in hfs_bnode_create()
413 spin_unlock(&tree->hash_lock); in hfs_bnode_create()
419 node = __hfs_bnode_create(tree, num); in hfs_bnode_create()
429 min((int)PAGE_SIZE, (int)tree->node_size)); in hfs_bnode_create()
432 for (i = 1; i < tree->pages_per_bnode; i++) { in hfs_bnode_create()
448 node->tree->cnid, node->this, in hfs_bnode_get()
457 struct hfs_btree *tree = node->tree; in hfs_bnode_put() local
461 node->tree->cnid, node->this, in hfs_bnode_put()
464 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock)) in hfs_bnode_put()
466 for (i = 0; i < tree->pages_per_bnode; i++) { in hfs_bnode_put()
474 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
479 spin_unlock(&tree->hash_lock); in hfs_bnode_put()