Lines Matching refs:osb
201 ocfs2_find_refcount_tree(struct ocfs2_super *osb, u64 blkno) in ocfs2_find_refcount_tree() argument
203 struct rb_node *n = osb->osb_rf_lock_tree.rb_node; in ocfs2_find_refcount_tree()
221 static void ocfs2_insert_refcount_tree(struct ocfs2_super *osb, in ocfs2_insert_refcount_tree() argument
226 struct rb_node **p = &osb->osb_rf_lock_tree.rb_node; in ocfs2_insert_refcount_tree()
248 rb_insert_color(&new->rf_node, &osb->osb_rf_lock_tree); in ocfs2_insert_refcount_tree()
260 ocfs2_erase_refcount_tree_from_list_no_lock(struct ocfs2_super *osb, 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()
265 osb->osb_ref_tree_lru = NULL; in ocfs2_erase_refcount_tree_from_list_no_lock()
268 static void ocfs2_erase_refcount_tree_from_list(struct ocfs2_super *osb, in ocfs2_erase_refcount_tree_from_list() argument
271 spin_lock(&osb->osb_lock); in ocfs2_erase_refcount_tree_from_list()
272 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_erase_refcount_tree_from_list()
273 spin_unlock(&osb->osb_lock); in ocfs2_erase_refcount_tree_from_list()
305 static inline void ocfs2_init_refcount_tree_lock(struct ocfs2_super *osb, in ocfs2_init_refcount_tree_lock() argument
310 ocfs2_refcount_lock_res_init(&new->rf_lockres, osb, in ocfs2_init_refcount_tree_lock()
315 ocfs2_allocate_refcount_tree(struct ocfs2_super *osb, u64 rf_blkno) in ocfs2_allocate_refcount_tree() argument
325 ocfs2_init_refcount_tree_ci(new, osb->sb); in ocfs2_allocate_refcount_tree()
330 static int ocfs2_get_refcount_tree(struct ocfs2_super *osb, u64 rf_blkno, in ocfs2_get_refcount_tree() argument
338 spin_lock(&osb->osb_lock); in ocfs2_get_refcount_tree()
339 if (osb->osb_ref_tree_lru && in ocfs2_get_refcount_tree()
340 osb->osb_ref_tree_lru->rf_blkno == rf_blkno) in ocfs2_get_refcount_tree()
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()
347 spin_unlock(&osb->osb_lock); in ocfs2_get_refcount_tree()
349 new = ocfs2_allocate_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
373 ocfs2_init_refcount_tree_lock(osb, new, rf_blkno, in ocfs2_get_refcount_tree()
377 spin_lock(&osb->osb_lock); in ocfs2_get_refcount_tree()
378 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
382 ocfs2_insert_refcount_tree(osb, new); in ocfs2_get_refcount_tree()
390 osb->osb_ref_tree_lru = tree; in ocfs2_get_refcount_tree()
392 spin_unlock(&osb->osb_lock); in ocfs2_get_refcount_tree()
422 static int __ocfs2_lock_refcount_tree(struct ocfs2_super *osb, in __ocfs2_lock_refcount_tree() argument
450 int ocfs2_lock_refcount_tree(struct ocfs2_super *osb, in ocfs2_lock_refcount_tree() argument
461 ret = ocfs2_get_refcount_tree(osb, ref_blkno, &tree); in ocfs2_lock_refcount_tree()
469 ret = __ocfs2_lock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
480 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
497 ocfs2_erase_refcount_tree_from_list(osb, tree); in ocfs2_lock_refcount_tree()
502 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
524 void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb, in ocfs2_unlock_refcount_tree() argument
536 void ocfs2_purge_refcount_trees(struct ocfs2_super *osb) in ocfs2_purge_refcount_trees() argument
540 struct rb_root *root = &osb->osb_rf_lock_tree; in ocfs2_purge_refcount_trees()
565 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_create_refcount_tree() local
578 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac); in ocfs2_create_refcount_tree()
584 handle = ocfs2_start_trans(osb, OCFS2_REFCOUNT_TREE_CREATE_CREDITS); in ocfs2_create_refcount_tree()
606 new_tree = ocfs2_allocate_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
635 rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); in ocfs2_create_refcount_tree()
639 cpu_to_le16(ocfs2_refcount_recs_per_rb(osb->sb)); in ocfs2_create_refcount_tree()
640 spin_lock(&osb->osb_lock); in ocfs2_create_refcount_tree()
641 rb->rf_generation = osb->s_next_generation++; in ocfs2_create_refcount_tree()
642 spin_unlock(&osb->osb_lock); in ocfs2_create_refcount_tree()
661 ocfs2_init_refcount_tree_lock(osb, new_tree, first_blkno, in ocfs2_create_refcount_tree()
664 spin_lock(&osb->osb_lock); in ocfs2_create_refcount_tree()
665 tree = ocfs2_find_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
675 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_create_refcount_tree()
676 ocfs2_insert_refcount_tree(osb, new_tree); in ocfs2_create_refcount_tree()
677 spin_unlock(&osb->osb_lock); in ocfs2_create_refcount_tree()
683 ocfs2_commit_trans(osb, handle); in ocfs2_create_refcount_tree()
706 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_set_refcount_tree() local
713 ret = ocfs2_lock_refcount_tree(osb, refcount_loc, 1, in ocfs2_set_refcount_tree()
720 handle = ocfs2_start_trans(osb, OCFS2_REFCOUNT_TREE_SET_CREDITS); in ocfs2_set_refcount_tree()
754 ocfs2_commit_trans(osb, handle); in ocfs2_set_refcount_tree()
756 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_set_refcount_tree()
768 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_remove_refcount_tree() local
782 ret = ocfs2_lock_refcount_tree(osb, ref_blkno, 1, &ref_tree, &blk_bh); in ocfs2_remove_refcount_tree()
802 alloc_inode = ocfs2_get_system_file_inode(osb, in ocfs2_remove_refcount_tree()
821 handle = ocfs2_start_trans(osb, credits); in ocfs2_remove_refcount_tree()
854 ocfs2_erase_refcount_tree_from_list(osb, ref_tree); in ocfs2_remove_refcount_tree()
862 ocfs2_commit_trans(osb, handle); in ocfs2_remove_refcount_tree()
874 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_remove_refcount_tree()
3011 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_duplicate_clusters_by_jbd() local
3019 new_bh = sb_getblk(osb->sb, new_block); in ocfs2_duplicate_clusters_by_jbd()
3212 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_make_clusters_writable() local
3236 handle = ocfs2_start_trans(osb, credits); in ocfs2_make_clusters_writable()
3339 ocfs2_commit_trans(osb, handle); in ocfs2_make_clusters_writable()
3362 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_replace_cow() local
3397 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_replace_cow()
3398 ocfs2_run_deallocs(osb, &context->dealloc); in ocfs2_replace_cow()
3416 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_refcount_cow_hunk() local
3445 ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), in ocfs2_refcount_cow_hunk()
3474 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_refcount_cow_hunk()
3696 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_add_refcount_flag() local
3722 handle = ocfs2_start_trans(osb, credits); in ocfs2_add_refcount_flag()
3752 ocfs2_commit_trans(osb, handle); in ocfs2_add_refcount_flag()
3800 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_attach_refcount_tree() local
3819 ret = ocfs2_lock_refcount_tree(osb, in ocfs2_attach_refcount_tree()
3878 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_attach_refcount_tree()
3882 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_attach_refcount_tree()
3883 ocfs2_run_deallocs(osb, &dealloc); in ocfs2_attach_refcount_tree()
3906 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_add_refcounted_extent() local
3919 handle = ocfs2_start_trans(osb, credits); in ocfs2_add_refcounted_extent()
3941 ocfs2_commit_trans(osb, handle); in ocfs2_add_refcounted_extent()
3955 struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb); in ocfs2_duplicate_inline_data() local
3961 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); in ocfs2_duplicate_inline_data()
3986 ocfs2_commit_trans(osb, handle); in ocfs2_duplicate_inline_data()
4123 struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb); in ocfs2_create_reflink_node() local
4145 ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), in ocfs2_create_reflink_node()
4162 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_create_reflink_node()
4166 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_create_reflink_node()
4167 ocfs2_run_deallocs(osb, &dealloc); in ocfs2_create_reflink_node()