Lines Matching refs:tree
204 struct ocfs2_refcount_tree *tree = NULL; in ocfs2_find_refcount_tree() local
207 tree = rb_entry(n, struct ocfs2_refcount_tree, rf_node); in ocfs2_find_refcount_tree()
209 if (blkno < tree->rf_blkno) in ocfs2_find_refcount_tree()
211 else if (blkno > tree->rf_blkno) in ocfs2_find_refcount_tree()
214 return tree; in ocfs2_find_refcount_tree()
251 static void ocfs2_free_refcount_tree(struct ocfs2_refcount_tree *tree) in ocfs2_free_refcount_tree() argument
253 ocfs2_metadata_cache_exit(&tree->rf_ci); in ocfs2_free_refcount_tree()
254 ocfs2_simple_drop_lockres(OCFS2_SB(tree->rf_sb), &tree->rf_lockres); in ocfs2_free_refcount_tree()
255 ocfs2_lock_res_free(&tree->rf_lockres); in ocfs2_free_refcount_tree()
256 kfree(tree); in ocfs2_free_refcount_tree()
261 struct ocfs2_refcount_tree *tree) in ocfs2_erase_refcount_tree_from_list_no_lock() argument
263 rb_erase(&tree->rf_node, &osb->osb_rf_lock_tree); in ocfs2_erase_refcount_tree_from_list_no_lock()
264 if (osb->osb_ref_tree_lru && osb->osb_ref_tree_lru == tree) in ocfs2_erase_refcount_tree_from_list_no_lock()
269 struct ocfs2_refcount_tree *tree) in ocfs2_erase_refcount_tree_from_list() argument
272 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_erase_refcount_tree_from_list()
278 struct ocfs2_refcount_tree *tree = in ocfs2_kref_remove_refcount_tree() local
281 ocfs2_free_refcount_tree(tree); in ocfs2_kref_remove_refcount_tree()
285 ocfs2_refcount_tree_get(struct ocfs2_refcount_tree *tree) in ocfs2_refcount_tree_get() argument
287 kref_get(&tree->rf_getcnt); in ocfs2_refcount_tree_get()
291 ocfs2_refcount_tree_put(struct ocfs2_refcount_tree *tree) in ocfs2_refcount_tree_put() argument
293 kref_put(&tree->rf_getcnt, ocfs2_kref_remove_refcount_tree); in ocfs2_refcount_tree_put()
334 struct ocfs2_refcount_tree *tree, *new = NULL; in ocfs2_get_refcount_tree() local
341 tree = osb->osb_ref_tree_lru; in ocfs2_get_refcount_tree()
343 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
344 if (tree) in ocfs2_get_refcount_tree()
378 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
379 if (tree) in ocfs2_get_refcount_tree()
384 tree = new; in ocfs2_get_refcount_tree()
388 *ret_tree = tree; in ocfs2_get_refcount_tree()
390 osb->osb_ref_tree_lru = tree; in ocfs2_get_refcount_tree()
423 struct ocfs2_refcount_tree *tree, int rw) in __ocfs2_lock_refcount_tree() argument
427 ret = ocfs2_refcount_lock(tree, rw); in __ocfs2_lock_refcount_tree()
434 down_write(&tree->rf_sem); in __ocfs2_lock_refcount_tree()
436 down_read(&tree->rf_sem); in __ocfs2_lock_refcount_tree()
456 struct ocfs2_refcount_tree *tree = NULL; in ocfs2_lock_refcount_tree() local
461 ret = ocfs2_get_refcount_tree(osb, ref_blkno, &tree); in ocfs2_lock_refcount_tree()
467 ocfs2_refcount_tree_get(tree); in ocfs2_lock_refcount_tree()
469 ret = __ocfs2_lock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
472 ocfs2_refcount_tree_put(tree); in ocfs2_lock_refcount_tree()
476 ret = ocfs2_read_refcount_block(&tree->rf_ci, tree->rf_blkno, in ocfs2_lock_refcount_tree()
480 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
481 ocfs2_refcount_tree_put(tree); in ocfs2_lock_refcount_tree()
495 if (tree->rf_generation != le32_to_cpu(rb->rf_generation)) { in ocfs2_lock_refcount_tree()
496 if (!tree->rf_removed) { in ocfs2_lock_refcount_tree()
497 ocfs2_erase_refcount_tree_from_list(osb, tree); in ocfs2_lock_refcount_tree()
498 tree->rf_removed = 1; in ocfs2_lock_refcount_tree()
502 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
508 ocfs2_refcount_tree_put(tree); in ocfs2_lock_refcount_tree()
514 *ret_tree = tree; in ocfs2_lock_refcount_tree()
525 struct ocfs2_refcount_tree *tree, int rw) in ocfs2_unlock_refcount_tree() argument
528 up_write(&tree->rf_sem); in ocfs2_unlock_refcount_tree()
530 up_read(&tree->rf_sem); in ocfs2_unlock_refcount_tree()
532 ocfs2_refcount_unlock(tree, rw); in ocfs2_unlock_refcount_tree()
533 ocfs2_refcount_tree_put(tree); in ocfs2_unlock_refcount_tree()
539 struct ocfs2_refcount_tree *tree; in ocfs2_purge_refcount_trees() local
543 tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node); in ocfs2_purge_refcount_trees()
546 (unsigned long long) tree->rf_blkno); in ocfs2_purge_refcount_trees()
548 rb_erase(&tree->rf_node, root); in ocfs2_purge_refcount_trees()
549 ocfs2_free_refcount_tree(tree); in ocfs2_purge_refcount_trees()
568 struct ocfs2_refcount_tree *new_tree = NULL, *tree = NULL; in ocfs2_create_refcount_tree() local
665 tree = ocfs2_find_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
673 BUG_ON(tree && tree->rf_generation == new_tree->rf_generation); in ocfs2_create_refcount_tree()
674 if (tree) in ocfs2_create_refcount_tree()
675 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_create_refcount_tree()
679 if (tree) in ocfs2_create_refcount_tree()
680 ocfs2_refcount_tree_put(tree); in ocfs2_create_refcount_tree()
2304 struct ocfs2_refcount_tree *tree; in ocfs2_decrease_refcount() local
2314 ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno, &tree); in ocfs2_decrease_refcount()
2320 ret = ocfs2_read_refcount_block(&tree->rf_ci, tree->rf_blkno, in ocfs2_decrease_refcount()
2327 ret = __ocfs2_decrease_refcount(handle, &tree->rf_ci, ref_root_bh, in ocfs2_decrease_refcount()
2538 struct ocfs2_refcount_tree *tree; in ocfs2_prepare_refcount_change_for_del() local
2550 refcount_loc, &tree); in ocfs2_prepare_refcount_change_for_del()
2556 ret = ocfs2_read_refcount_block(&tree->rf_ci, refcount_loc, in ocfs2_prepare_refcount_change_for_del()
2564 &tree->rf_ci, in ocfs2_prepare_refcount_change_for_del()