Lines Matching defs:tree

197 	struct ocfs2_refcount_tree *tree = NULL;
200 tree = rb_entry(n, struct ocfs2_refcount_tree, rf_node);
202 if (blkno < tree->rf_blkno)
204 else if (blkno > tree->rf_blkno)
207 return tree;
244 static void ocfs2_free_refcount_tree(struct ocfs2_refcount_tree *tree)
246 ocfs2_metadata_cache_exit(&tree->rf_ci);
247 ocfs2_simple_drop_lockres(OCFS2_SB(tree->rf_sb), &tree->rf_lockres);
248 ocfs2_lock_res_free(&tree->rf_lockres);
249 kfree(tree);
254 struct ocfs2_refcount_tree *tree)
256 rb_erase(&tree->rf_node, &osb->osb_rf_lock_tree);
257 if (osb->osb_ref_tree_lru && osb->osb_ref_tree_lru == tree)
262 struct ocfs2_refcount_tree *tree)
265 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree);
271 struct ocfs2_refcount_tree *tree =
274 ocfs2_free_refcount_tree(tree);
278 ocfs2_refcount_tree_get(struct ocfs2_refcount_tree *tree)
280 kref_get(&tree->rf_getcnt);
284 ocfs2_refcount_tree_put(struct ocfs2_refcount_tree *tree)
286 kref_put(&tree->rf_getcnt, ocfs2_kref_remove_refcount_tree);
327 struct ocfs2_refcount_tree *tree, *new = NULL;
334 tree = osb->osb_ref_tree_lru;
336 tree = ocfs2_find_refcount_tree(osb, rf_blkno);
337 if (tree)
349 * We need the generation to create the refcount tree lock and since
350 * it isn't changed during the tree modification, we are safe here to
371 tree = ocfs2_find_refcount_tree(osb, rf_blkno);
372 if (tree)
377 tree = new;
381 *ret_tree = tree;
383 osb->osb_ref_tree_lru = tree;
416 struct ocfs2_refcount_tree *tree, int rw)
420 ret = ocfs2_refcount_lock(tree, rw);
427 down_write(&tree->rf_sem);
429 down_read(&tree->rf_sem);
436 * Lock the refcount tree pointed by ref_blkno and return the tree.
437 * In most case, we lock the tree and read the refcount block.
440 * If the tree has been re-created by other node, it will free the
449 struct ocfs2_refcount_tree *tree = NULL;
454 ret = ocfs2_get_refcount_tree(osb, ref_blkno, &tree);
460 ocfs2_refcount_tree_get(tree);
462 ret = __ocfs2_lock_refcount_tree(osb, tree, rw);
465 ocfs2_refcount_tree_put(tree);
469 ret = ocfs2_read_refcount_block(&tree->rf_ci, tree->rf_blkno,
473 ocfs2_unlock_refcount_tree(osb, tree, rw);
480 * to recreate the refcount tree also.
482 * Here we just remove the tree from the rb-tree, and the last
485 * the new refcount tree for us.
487 if (tree->rf_generation != le32_to_cpu(rb->rf_generation)) {
488 if (!tree->rf_removed) {
489 ocfs2_erase_refcount_tree_from_list(osb, tree);
490 tree->rf_removed = 1;
494 ocfs2_unlock_refcount_tree(osb, tree, rw);
497 * tree, so another put will destroy it.
500 ocfs2_refcount_tree_put(tree);
506 *ret_tree = tree;
517 struct ocfs2_refcount_tree *tree, int rw)
520 up_write(&tree->rf_sem);
522 up_read(&tree->rf_sem);
524 ocfs2_refcount_unlock(tree, rw);
525 ocfs2_refcount_tree_put(tree);
531 struct ocfs2_refcount_tree *tree;
535 tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node);
538 (unsigned long long) tree->rf_blkno);
540 rb_erase(&tree->rf_node, root);
541 ocfs2_free_refcount_tree(tree);
546 * Create a refcount tree for an inode.
560 struct ocfs2_refcount_tree *new_tree = NULL, *tree = NULL;
649 * We have to init the tree lock here since it will use
657 tree = ocfs2_find_refcount_tree(osb, first_blkno);
660 * We've just created a new refcount tree in this block. If
661 * we found a refcount tree on the ocfs2_super, it must be
662 * one we just deleted. We free the old tree before
663 * inserting the new tree.
665 BUG_ON(tree && tree->rf_generation == new_tree->rf_generation);
666 if (tree)
667 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree);
671 if (tree)
672 ocfs2_refcount_tree_put(tree);
917 * Try to remove refcount tree. The mechanism is:
921 * 4) Remove the tree.
992 * the subroot. Otherwise we may corrupt the b-tree.
1096 "refcount tree %llu has non zero tree depth in leaf btree tree block %llu\n",
1404 * But we will use the low 32 bit to be the e_cpos in the b-tree.
1619 * the old root bh hasn't been expanded to a b-tree,
1634 /* Now add a new refcount block into the tree.*/
1645 * Adjust the extent rec in b-tree representing ref_leaf_bh.
1815 * This is much simple than our b-tree code.
2285 /* Caller must hold refcount tree lock. */
2295 struct ocfs2_refcount_tree *tree;
2305 ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno, &tree);
2311 ret = ocfs2_read_refcount_block(&tree->rf_ci, tree->rf_blkno,
2318 ret = __ocfs2_decrease_refcount(handle, &tree->rf_ci, ref_root_bh,
2349 ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
2478 * So we may need ref_blocks to insert into the tree.
2479 * That also means we need to change the b-tree and add that number
2508 * For refcount tree, we will decrease some contiguous clusters
2517 * Caller must hold refcount tree lock.
2528 struct ocfs2_refcount_tree *tree;
2532 ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
2540 refcount_loc, &tree);
2546 ret = ocfs2_read_refcount_block(&tree->rf_ci, refcount_loc,
2554 &tree->rf_ci,
2625 * get good I/O from the resulting extent tree.
2658 "Inode %lu has non zero tree depth in leaf block %llu\n",
2828 * clusters(starting form p_cluster) in the refcount tree.
2831 * 1. since we may split the old tree, so we at most will need num_clusters + 2
3336 return ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
3506 * refcount tree change if we truncate it to 0.
3651 * Insert a new extent into refcount tree and mark a extent rec
3652 * as refcounted in the dinode tree.
3668 /* We need to be able to handle at least an extent tree split. */
4586 /* Set up refcount tree and remap s_inode to t_inode. */
4631 /* Neither inode has a refcount tree. Add one to s_inode. */
4641 /* Ensure that both inodes end up with the same refcount tree. */