Lines Matching refs:osb

203 ocfs2_find_refcount_tree(struct ocfs2_super *osb, u64 blkno)  in ocfs2_find_refcount_tree()  argument
205 struct rb_node *n = osb->osb_rf_lock_tree.rb_node; in ocfs2_find_refcount_tree()
223 static void ocfs2_insert_refcount_tree(struct ocfs2_super *osb, in ocfs2_insert_refcount_tree() argument
228 struct rb_node **p = &osb->osb_rf_lock_tree.rb_node; in ocfs2_insert_refcount_tree()
250 rb_insert_color(&new->rf_node, &osb->osb_rf_lock_tree); in ocfs2_insert_refcount_tree()
262 ocfs2_erase_refcount_tree_from_list_no_lock(struct ocfs2_super *osb, 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()
267 osb->osb_ref_tree_lru = NULL; in ocfs2_erase_refcount_tree_from_list_no_lock()
270 static void ocfs2_erase_refcount_tree_from_list(struct ocfs2_super *osb, in ocfs2_erase_refcount_tree_from_list() argument
273 spin_lock(&osb->osb_lock); in ocfs2_erase_refcount_tree_from_list()
274 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_erase_refcount_tree_from_list()
275 spin_unlock(&osb->osb_lock); in ocfs2_erase_refcount_tree_from_list()
307 static inline void ocfs2_init_refcount_tree_lock(struct ocfs2_super *osb, in ocfs2_init_refcount_tree_lock() argument
312 ocfs2_refcount_lock_res_init(&new->rf_lockres, osb, in ocfs2_init_refcount_tree_lock()
317 ocfs2_allocate_refcount_tree(struct ocfs2_super *osb, u64 rf_blkno) in ocfs2_allocate_refcount_tree() argument
327 ocfs2_init_refcount_tree_ci(new, osb->sb); in ocfs2_allocate_refcount_tree()
332 static int ocfs2_get_refcount_tree(struct ocfs2_super *osb, u64 rf_blkno, in ocfs2_get_refcount_tree() argument
340 spin_lock(&osb->osb_lock); in ocfs2_get_refcount_tree()
341 if (osb->osb_ref_tree_lru && in ocfs2_get_refcount_tree()
342 osb->osb_ref_tree_lru->rf_blkno == rf_blkno) in ocfs2_get_refcount_tree()
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()
349 spin_unlock(&osb->osb_lock); in ocfs2_get_refcount_tree()
351 new = ocfs2_allocate_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
375 ocfs2_init_refcount_tree_lock(osb, new, rf_blkno, in ocfs2_get_refcount_tree()
379 spin_lock(&osb->osb_lock); in ocfs2_get_refcount_tree()
380 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
384 ocfs2_insert_refcount_tree(osb, new); in ocfs2_get_refcount_tree()
392 osb->osb_ref_tree_lru = tree; in ocfs2_get_refcount_tree()
394 spin_unlock(&osb->osb_lock); in ocfs2_get_refcount_tree()
424 static int __ocfs2_lock_refcount_tree(struct ocfs2_super *osb, in __ocfs2_lock_refcount_tree() argument
452 int ocfs2_lock_refcount_tree(struct ocfs2_super *osb, in ocfs2_lock_refcount_tree() argument
463 ret = ocfs2_get_refcount_tree(osb, ref_blkno, &tree); in ocfs2_lock_refcount_tree()
471 ret = __ocfs2_lock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
482 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
499 ocfs2_erase_refcount_tree_from_list(osb, tree); in ocfs2_lock_refcount_tree()
504 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
526 void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb, in ocfs2_unlock_refcount_tree() argument
538 void ocfs2_purge_refcount_trees(struct ocfs2_super *osb) in ocfs2_purge_refcount_trees() argument
542 struct rb_root *root = &osb->osb_rf_lock_tree; in ocfs2_purge_refcount_trees()
567 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_create_refcount_tree() local
580 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac); in ocfs2_create_refcount_tree()
586 handle = ocfs2_start_trans(osb, OCFS2_REFCOUNT_TREE_CREATE_CREDITS); in ocfs2_create_refcount_tree()
608 new_tree = ocfs2_allocate_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
637 rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); in ocfs2_create_refcount_tree()
641 cpu_to_le16(ocfs2_refcount_recs_per_rb(osb->sb)); in ocfs2_create_refcount_tree()
642 spin_lock(&osb->osb_lock); in ocfs2_create_refcount_tree()
643 rb->rf_generation = osb->s_next_generation++; in ocfs2_create_refcount_tree()
644 spin_unlock(&osb->osb_lock); in ocfs2_create_refcount_tree()
663 ocfs2_init_refcount_tree_lock(osb, new_tree, first_blkno, in ocfs2_create_refcount_tree()
666 spin_lock(&osb->osb_lock); in ocfs2_create_refcount_tree()
667 tree = ocfs2_find_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
677 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_create_refcount_tree()
678 ocfs2_insert_refcount_tree(osb, new_tree); in ocfs2_create_refcount_tree()
679 spin_unlock(&osb->osb_lock); in ocfs2_create_refcount_tree()
685 ocfs2_commit_trans(osb, handle); in ocfs2_create_refcount_tree()
708 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_set_refcount_tree() local
715 ret = ocfs2_lock_refcount_tree(osb, refcount_loc, 1, in ocfs2_set_refcount_tree()
722 handle = ocfs2_start_trans(osb, OCFS2_REFCOUNT_TREE_SET_CREDITS); in ocfs2_set_refcount_tree()
756 ocfs2_commit_trans(osb, handle); in ocfs2_set_refcount_tree()
758 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_set_refcount_tree()
770 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_remove_refcount_tree() local
784 ret = ocfs2_lock_refcount_tree(osb, ref_blkno, 1, &ref_tree, &blk_bh); in ocfs2_remove_refcount_tree()
804 alloc_inode = ocfs2_get_system_file_inode(osb, in ocfs2_remove_refcount_tree()
823 handle = ocfs2_start_trans(osb, credits); in ocfs2_remove_refcount_tree()
856 ocfs2_erase_refcount_tree_from_list(osb, ref_tree); in ocfs2_remove_refcount_tree()
864 ocfs2_commit_trans(osb, handle); in ocfs2_remove_refcount_tree()
876 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_remove_refcount_tree()
3025 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_duplicate_clusters_by_jbd() local
3033 new_bh = sb_getblk(osb->sb, new_block); in ocfs2_duplicate_clusters_by_jbd()
3228 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_make_clusters_writable() local
3252 handle = ocfs2_start_trans(osb, credits); in ocfs2_make_clusters_writable()
3355 ocfs2_commit_trans(osb, handle); in ocfs2_make_clusters_writable()
3378 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_replace_cow() local
3415 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_replace_cow()
3416 ocfs2_run_deallocs(osb, &context->dealloc); in ocfs2_replace_cow()
3434 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_refcount_cow_hunk() local
3463 ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), in ocfs2_refcount_cow_hunk()
3492 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_refcount_cow_hunk()
3714 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_add_refcount_flag() local
3740 handle = ocfs2_start_trans(osb, credits); in ocfs2_add_refcount_flag()
3770 ocfs2_commit_trans(osb, handle); in ocfs2_add_refcount_flag()
3818 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_attach_refcount_tree() local
3837 ret = ocfs2_lock_refcount_tree(osb, in ocfs2_attach_refcount_tree()
3896 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_attach_refcount_tree()
3900 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_attach_refcount_tree()
3901 ocfs2_run_deallocs(osb, &dealloc); in ocfs2_attach_refcount_tree()
3924 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_add_refcounted_extent() local
3937 handle = ocfs2_start_trans(osb, credits); in ocfs2_add_refcounted_extent()
3959 ocfs2_commit_trans(osb, handle); in ocfs2_add_refcounted_extent()
3973 struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb); in ocfs2_duplicate_inline_data() local
3979 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); in ocfs2_duplicate_inline_data()
4004 ocfs2_commit_trans(osb, handle); in ocfs2_duplicate_inline_data()
4141 struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb); in ocfs2_create_reflink_node() local
4163 ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), in ocfs2_create_reflink_node()
4180 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_create_reflink_node()
4184 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_create_reflink_node()
4185 ocfs2_run_deallocs(osb, &dealloc); in ocfs2_create_reflink_node()