Lines Matching refs:tree
21 bool is_valid = off < node->tree->node_size; in is_bnode_offset_valid()
28 node->tree->node_size, off); in is_bnode_offset_valid()
42 node_size = node->tree->node_size; in check_and_correct_requested_length()
52 node->tree->node_size, off, len, new_len); in check_and_correct_requested_length()
75 node->tree->node_size, off, len); in hfs_bnode_read()
86 if (pagenum >= node->tree->pages_per_bnode) in hfs_bnode_read()
116 struct hfs_btree *tree; in hfs_bnode_read_key() local
119 tree = node->tree; in hfs_bnode_read_key()
121 tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_bnode_read_key()
124 key_len = tree->max_key_len + 1; in hfs_bnode_read_key()
147 node->tree->node_size, off, len); in hfs_bnode_write()
185 node->tree->node_size, off, len); in hfs_bnode_clear()
252 off = node->tree->node_size - 2; in hfs_bnode_dump()
259 if (node->tree->attributes & HFS_TREE_VARIDXKEYS) in hfs_bnode_dump()
262 tmp = node->tree->max_key_len + 1; in hfs_bnode_dump()
279 struct hfs_btree *tree; in hfs_bnode_unlink() local
283 tree = node->tree; in hfs_bnode_unlink()
285 tmp = hfs_bnode_find(tree, node->prev); in hfs_bnode_unlink()
293 tree->leaf_head = node->next; in hfs_bnode_unlink()
296 tmp = hfs_bnode_find(tree, node->next); in hfs_bnode_unlink()
304 tree->leaf_tail = node->prev; in hfs_bnode_unlink()
311 tree->root = 0; in hfs_bnode_unlink()
312 tree->depth = 0; in hfs_bnode_unlink()
324 struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) in hfs_bnode_findhash() argument
328 if (cnid >= tree->node_count) { in hfs_bnode_findhash()
333 for (node = tree->node_hash[hfs_bnode_hash(cnid)]; in hfs_bnode_findhash()
342 static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) in __hfs_bnode_create() argument
350 if (cnid >= tree->node_count) { in __hfs_bnode_create()
355 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * in __hfs_bnode_create()
360 node->tree = tree; in __hfs_bnode_create()
365 node->tree->cnid, node->this); in __hfs_bnode_create()
367 spin_lock(&tree->hash_lock); in __hfs_bnode_create()
368 node2 = hfs_bnode_findhash(tree, cnid); in __hfs_bnode_create()
371 node->next_hash = tree->node_hash[hash]; in __hfs_bnode_create()
372 tree->node_hash[hash] = node; in __hfs_bnode_create()
373 tree->node_hash_cnt++; in __hfs_bnode_create()
376 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
381 spin_unlock(&tree->hash_lock); in __hfs_bnode_create()
383 mapping = tree->inode->i_mapping; in __hfs_bnode_create()
384 off = (loff_t)cnid * tree->node_size; in __hfs_bnode_create()
387 for (i = 0; i < tree->pages_per_bnode; i++) { in __hfs_bnode_create()
405 node->tree->cnid, node->this, atomic_read(&node->refcnt)); in hfs_bnode_unhash()
406 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; in hfs_bnode_unhash()
411 node->tree->node_hash_cnt--; in hfs_bnode_unhash()
415 struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num) in hfs_bnode_find() argument
422 spin_lock(&tree->hash_lock); in hfs_bnode_find()
423 node = hfs_bnode_findhash(tree, num); in hfs_bnode_find()
426 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
432 spin_unlock(&tree->hash_lock); in hfs_bnode_find()
433 node = __hfs_bnode_create(tree, num); in hfs_bnode_find()
461 if (node->height <= 1 || node->height > tree->depth) in hfs_bnode_find()
468 rec_off = tree->node_size - 2; in hfs_bnode_find()
476 next_off > tree->node_size || in hfs_bnode_find()
503 for (i = 0; i < node->tree->pages_per_bnode; i++) in hfs_bnode_free()
509 struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) in hfs_bnode_create() argument
515 spin_lock(&tree->hash_lock); in hfs_bnode_create()
516 node = hfs_bnode_findhash(tree, num); in hfs_bnode_create()
517 spin_unlock(&tree->hash_lock); in hfs_bnode_create()
523 node = __hfs_bnode_create(tree, num); in hfs_bnode_create()
533 min((int)PAGE_SIZE, (int)tree->node_size)); in hfs_bnode_create()
535 for (i = 1; i < tree->pages_per_bnode; i++) { in hfs_bnode_create()
550 node->tree->cnid, node->this, in hfs_bnode_get()
559 struct hfs_btree *tree = node->tree; in hfs_bnode_put() local
563 node->tree->cnid, node->this, in hfs_bnode_put()
566 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock)) in hfs_bnode_put()
568 for (i = 0; i < tree->pages_per_bnode; i++) { in hfs_bnode_put()
576 spin_unlock(&tree->hash_lock); in hfs_bnode_put()
577 hfs_bnode_clear(node, 0, tree->node_size); in hfs_bnode_put()
582 spin_unlock(&tree->hash_lock); in hfs_bnode_put()