Lines Matching refs:tree

198 	struct ocfs2_refcount_tree *tree = NULL;  in ocfs2_find_refcount_tree()  local
201 tree = rb_entry(n, struct ocfs2_refcount_tree, rf_node); in ocfs2_find_refcount_tree()
203 if (blkno < tree->rf_blkno) in ocfs2_find_refcount_tree()
205 else if (blkno > tree->rf_blkno) in ocfs2_find_refcount_tree()
208 return tree; in ocfs2_find_refcount_tree()
245 static void ocfs2_free_refcount_tree(struct ocfs2_refcount_tree *tree) in ocfs2_free_refcount_tree() argument
247 ocfs2_metadata_cache_exit(&tree->rf_ci); in ocfs2_free_refcount_tree()
248 ocfs2_simple_drop_lockres(OCFS2_SB(tree->rf_sb), &tree->rf_lockres); in ocfs2_free_refcount_tree()
249 ocfs2_lock_res_free(&tree->rf_lockres); in ocfs2_free_refcount_tree()
250 kfree(tree); in ocfs2_free_refcount_tree()
255 struct ocfs2_refcount_tree *tree) in ocfs2_erase_refcount_tree_from_list_no_lock() argument
257 rb_erase(&tree->rf_node, &osb->osb_rf_lock_tree); in ocfs2_erase_refcount_tree_from_list_no_lock()
258 if (osb->osb_ref_tree_lru && osb->osb_ref_tree_lru == tree) in ocfs2_erase_refcount_tree_from_list_no_lock()
263 struct ocfs2_refcount_tree *tree) in ocfs2_erase_refcount_tree_from_list() argument
266 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_erase_refcount_tree_from_list()
272 struct ocfs2_refcount_tree *tree = in ocfs2_kref_remove_refcount_tree() local
275 ocfs2_free_refcount_tree(tree); in ocfs2_kref_remove_refcount_tree()
279 ocfs2_refcount_tree_get(struct ocfs2_refcount_tree *tree) in ocfs2_refcount_tree_get() argument
281 kref_get(&tree->rf_getcnt); in ocfs2_refcount_tree_get()
285 ocfs2_refcount_tree_put(struct ocfs2_refcount_tree *tree) in ocfs2_refcount_tree_put() argument
287 kref_put(&tree->rf_getcnt, ocfs2_kref_remove_refcount_tree); in ocfs2_refcount_tree_put()
328 struct ocfs2_refcount_tree *tree, *new = NULL; in ocfs2_get_refcount_tree() local
335 tree = osb->osb_ref_tree_lru; in ocfs2_get_refcount_tree()
337 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
338 if (tree) in ocfs2_get_refcount_tree()
372 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
373 if (tree) in ocfs2_get_refcount_tree()
378 tree = new; in ocfs2_get_refcount_tree()
382 *ret_tree = tree; in ocfs2_get_refcount_tree()
384 osb->osb_ref_tree_lru = tree; in ocfs2_get_refcount_tree()
417 struct ocfs2_refcount_tree *tree, int rw) in __ocfs2_lock_refcount_tree() argument
421 ret = ocfs2_refcount_lock(tree, rw); in __ocfs2_lock_refcount_tree()
428 down_write(&tree->rf_sem); in __ocfs2_lock_refcount_tree()
430 down_read(&tree->rf_sem); in __ocfs2_lock_refcount_tree()
450 struct ocfs2_refcount_tree *tree = NULL; in ocfs2_lock_refcount_tree() local
455 ret = ocfs2_get_refcount_tree(osb, ref_blkno, &tree); in ocfs2_lock_refcount_tree()
461 ocfs2_refcount_tree_get(tree); in ocfs2_lock_refcount_tree()
463 ret = __ocfs2_lock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
466 ocfs2_refcount_tree_put(tree); in ocfs2_lock_refcount_tree()
470 ret = ocfs2_read_refcount_block(&tree->rf_ci, tree->rf_blkno, in ocfs2_lock_refcount_tree()
474 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
488 if (tree->rf_generation != le32_to_cpu(rb->rf_generation)) { in ocfs2_lock_refcount_tree()
489 if (!tree->rf_removed) { in ocfs2_lock_refcount_tree()
490 ocfs2_erase_refcount_tree_from_list(osb, tree); in ocfs2_lock_refcount_tree()
491 tree->rf_removed = 1; in ocfs2_lock_refcount_tree()
495 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
501 ocfs2_refcount_tree_put(tree); in ocfs2_lock_refcount_tree()
507 *ret_tree = tree; in ocfs2_lock_refcount_tree()
518 struct ocfs2_refcount_tree *tree, int rw) in ocfs2_unlock_refcount_tree() argument
521 up_write(&tree->rf_sem); in ocfs2_unlock_refcount_tree()
523 up_read(&tree->rf_sem); in ocfs2_unlock_refcount_tree()
525 ocfs2_refcount_unlock(tree, rw); in ocfs2_unlock_refcount_tree()
526 ocfs2_refcount_tree_put(tree); in ocfs2_unlock_refcount_tree()
532 struct ocfs2_refcount_tree *tree; in ocfs2_purge_refcount_trees() local
536 tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node); in ocfs2_purge_refcount_trees()
539 (unsigned long long) tree->rf_blkno); in ocfs2_purge_refcount_trees()
541 rb_erase(&tree->rf_node, root); in ocfs2_purge_refcount_trees()
542 ocfs2_free_refcount_tree(tree); in ocfs2_purge_refcount_trees()
561 struct ocfs2_refcount_tree *new_tree = NULL, *tree = NULL; in ocfs2_create_refcount_tree() local
658 tree = ocfs2_find_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
666 BUG_ON(tree && tree->rf_generation == new_tree->rf_generation); in ocfs2_create_refcount_tree()
667 if (tree) in ocfs2_create_refcount_tree()
668 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_create_refcount_tree()
672 if (tree) in ocfs2_create_refcount_tree()
673 ocfs2_refcount_tree_put(tree); in ocfs2_create_refcount_tree()
2289 struct ocfs2_refcount_tree *tree; in ocfs2_decrease_refcount() local
2299 ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno, &tree); in ocfs2_decrease_refcount()
2305 ret = ocfs2_read_refcount_block(&tree->rf_ci, tree->rf_blkno, in ocfs2_decrease_refcount()
2312 ret = __ocfs2_decrease_refcount(handle, &tree->rf_ci, ref_root_bh, in ocfs2_decrease_refcount()
2522 struct ocfs2_refcount_tree *tree; in ocfs2_prepare_refcount_change_for_del() local
2534 refcount_loc, &tree); in ocfs2_prepare_refcount_change_for_del()
2540 ret = ocfs2_read_refcount_block(&tree->rf_ci, refcount_loc, in ocfs2_prepare_refcount_change_for_del()
2548 &tree->rf_ci, in ocfs2_prepare_refcount_change_for_del()