Lines Matching refs:tree
206 struct ocfs2_refcount_tree *tree = NULL; in ocfs2_find_refcount_tree() local
209 tree = rb_entry(n, struct ocfs2_refcount_tree, rf_node); in ocfs2_find_refcount_tree()
211 if (blkno < tree->rf_blkno) in ocfs2_find_refcount_tree()
213 else if (blkno > tree->rf_blkno) in ocfs2_find_refcount_tree()
216 return tree; in ocfs2_find_refcount_tree()
253 static void ocfs2_free_refcount_tree(struct ocfs2_refcount_tree *tree) in ocfs2_free_refcount_tree() argument
255 ocfs2_metadata_cache_exit(&tree->rf_ci); in ocfs2_free_refcount_tree()
256 ocfs2_simple_drop_lockres(OCFS2_SB(tree->rf_sb), &tree->rf_lockres); in ocfs2_free_refcount_tree()
257 ocfs2_lock_res_free(&tree->rf_lockres); in ocfs2_free_refcount_tree()
258 kfree(tree); in ocfs2_free_refcount_tree()
263 struct ocfs2_refcount_tree *tree) in ocfs2_erase_refcount_tree_from_list_no_lock() argument
265 rb_erase(&tree->rf_node, &osb->osb_rf_lock_tree); in ocfs2_erase_refcount_tree_from_list_no_lock()
266 if (osb->osb_ref_tree_lru && osb->osb_ref_tree_lru == tree) in ocfs2_erase_refcount_tree_from_list_no_lock()
271 struct ocfs2_refcount_tree *tree) in ocfs2_erase_refcount_tree_from_list() argument
274 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_erase_refcount_tree_from_list()
280 struct ocfs2_refcount_tree *tree = in ocfs2_kref_remove_refcount_tree() local
283 ocfs2_free_refcount_tree(tree); in ocfs2_kref_remove_refcount_tree()
287 ocfs2_refcount_tree_get(struct ocfs2_refcount_tree *tree) in ocfs2_refcount_tree_get() argument
289 kref_get(&tree->rf_getcnt); in ocfs2_refcount_tree_get()
293 ocfs2_refcount_tree_put(struct ocfs2_refcount_tree *tree) in ocfs2_refcount_tree_put() argument
295 kref_put(&tree->rf_getcnt, ocfs2_kref_remove_refcount_tree); in ocfs2_refcount_tree_put()
336 struct ocfs2_refcount_tree *tree, *new = NULL; in ocfs2_get_refcount_tree() local
343 tree = osb->osb_ref_tree_lru; in ocfs2_get_refcount_tree()
345 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
346 if (tree) in ocfs2_get_refcount_tree()
380 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
381 if (tree) in ocfs2_get_refcount_tree()
386 tree = new; in ocfs2_get_refcount_tree()
390 *ret_tree = tree; in ocfs2_get_refcount_tree()
392 osb->osb_ref_tree_lru = tree; in ocfs2_get_refcount_tree()
425 struct ocfs2_refcount_tree *tree, int rw) in __ocfs2_lock_refcount_tree() argument
429 ret = ocfs2_refcount_lock(tree, rw); in __ocfs2_lock_refcount_tree()
436 down_write(&tree->rf_sem); in __ocfs2_lock_refcount_tree()
438 down_read(&tree->rf_sem); in __ocfs2_lock_refcount_tree()
458 struct ocfs2_refcount_tree *tree = NULL; in ocfs2_lock_refcount_tree() local
463 ret = ocfs2_get_refcount_tree(osb, ref_blkno, &tree); in ocfs2_lock_refcount_tree()
469 ocfs2_refcount_tree_get(tree); in ocfs2_lock_refcount_tree()
471 ret = __ocfs2_lock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
474 ocfs2_refcount_tree_put(tree); in ocfs2_lock_refcount_tree()
478 ret = ocfs2_read_refcount_block(&tree->rf_ci, tree->rf_blkno, in ocfs2_lock_refcount_tree()
482 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
483 ocfs2_refcount_tree_put(tree); in ocfs2_lock_refcount_tree()
497 if (tree->rf_generation != le32_to_cpu(rb->rf_generation)) { in ocfs2_lock_refcount_tree()
498 if (!tree->rf_removed) { in ocfs2_lock_refcount_tree()
499 ocfs2_erase_refcount_tree_from_list(osb, tree); in ocfs2_lock_refcount_tree()
500 tree->rf_removed = 1; in ocfs2_lock_refcount_tree()
504 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
510 ocfs2_refcount_tree_put(tree); in ocfs2_lock_refcount_tree()
516 *ret_tree = tree; in ocfs2_lock_refcount_tree()
527 struct ocfs2_refcount_tree *tree, int rw) in ocfs2_unlock_refcount_tree() argument
530 up_write(&tree->rf_sem); in ocfs2_unlock_refcount_tree()
532 up_read(&tree->rf_sem); in ocfs2_unlock_refcount_tree()
534 ocfs2_refcount_unlock(tree, rw); in ocfs2_unlock_refcount_tree()
535 ocfs2_refcount_tree_put(tree); in ocfs2_unlock_refcount_tree()
541 struct ocfs2_refcount_tree *tree; in ocfs2_purge_refcount_trees() local
545 tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node); in ocfs2_purge_refcount_trees()
548 (unsigned long long) tree->rf_blkno); in ocfs2_purge_refcount_trees()
550 rb_erase(&tree->rf_node, root); in ocfs2_purge_refcount_trees()
551 ocfs2_free_refcount_tree(tree); in ocfs2_purge_refcount_trees()
570 struct ocfs2_refcount_tree *new_tree = NULL, *tree = NULL; in ocfs2_create_refcount_tree() local
667 tree = ocfs2_find_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
675 BUG_ON(tree && tree->rf_generation == new_tree->rf_generation); in ocfs2_create_refcount_tree()
676 if (tree) in ocfs2_create_refcount_tree()
677 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_create_refcount_tree()
681 if (tree) in ocfs2_create_refcount_tree()
682 ocfs2_refcount_tree_put(tree); in ocfs2_create_refcount_tree()
2310 struct ocfs2_refcount_tree *tree; in ocfs2_decrease_refcount() local
2320 ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno, &tree); in ocfs2_decrease_refcount()
2326 ret = ocfs2_read_refcount_block(&tree->rf_ci, tree->rf_blkno, in ocfs2_decrease_refcount()
2333 ret = __ocfs2_decrease_refcount(handle, &tree->rf_ci, ref_root_bh, in ocfs2_decrease_refcount()
2546 struct ocfs2_refcount_tree *tree; in ocfs2_prepare_refcount_change_for_del() local
2560 refcount_loc, &tree); in ocfs2_prepare_refcount_change_for_del()
2566 ret = ocfs2_read_refcount_block(&tree->rf_ci, refcount_loc, in ocfs2_prepare_refcount_change_for_del()
2574 &tree->rf_ci, in ocfs2_prepare_refcount_change_for_del()