Lines Matching refs:osb
195 ocfs2_find_refcount_tree(struct ocfs2_super *osb, u64 blkno) in ocfs2_find_refcount_tree() argument
197 struct rb_node *n = osb->osb_rf_lock_tree.rb_node; in ocfs2_find_refcount_tree()
215 static void ocfs2_insert_refcount_tree(struct ocfs2_super *osb, in ocfs2_insert_refcount_tree() argument
220 struct rb_node **p = &osb->osb_rf_lock_tree.rb_node; in ocfs2_insert_refcount_tree()
242 rb_insert_color(&new->rf_node, &osb->osb_rf_lock_tree); in ocfs2_insert_refcount_tree()
254 ocfs2_erase_refcount_tree_from_list_no_lock(struct ocfs2_super *osb, 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()
259 osb->osb_ref_tree_lru = NULL; in ocfs2_erase_refcount_tree_from_list_no_lock()
262 static void ocfs2_erase_refcount_tree_from_list(struct ocfs2_super *osb, in ocfs2_erase_refcount_tree_from_list() argument
265 spin_lock(&osb->osb_lock); in ocfs2_erase_refcount_tree_from_list()
266 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_erase_refcount_tree_from_list()
267 spin_unlock(&osb->osb_lock); in ocfs2_erase_refcount_tree_from_list()
299 static inline void ocfs2_init_refcount_tree_lock(struct ocfs2_super *osb, in ocfs2_init_refcount_tree_lock() argument
304 ocfs2_refcount_lock_res_init(&new->rf_lockres, osb, in ocfs2_init_refcount_tree_lock()
309 ocfs2_allocate_refcount_tree(struct ocfs2_super *osb, u64 rf_blkno) in ocfs2_allocate_refcount_tree() argument
319 ocfs2_init_refcount_tree_ci(new, osb->sb); in ocfs2_allocate_refcount_tree()
324 static int ocfs2_get_refcount_tree(struct ocfs2_super *osb, u64 rf_blkno, in ocfs2_get_refcount_tree() argument
332 spin_lock(&osb->osb_lock); in ocfs2_get_refcount_tree()
333 if (osb->osb_ref_tree_lru && in ocfs2_get_refcount_tree()
334 osb->osb_ref_tree_lru->rf_blkno == rf_blkno) in ocfs2_get_refcount_tree()
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()
341 spin_unlock(&osb->osb_lock); in ocfs2_get_refcount_tree()
343 new = ocfs2_allocate_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
367 ocfs2_init_refcount_tree_lock(osb, new, rf_blkno, in ocfs2_get_refcount_tree()
371 spin_lock(&osb->osb_lock); in ocfs2_get_refcount_tree()
372 tree = ocfs2_find_refcount_tree(osb, rf_blkno); in ocfs2_get_refcount_tree()
376 ocfs2_insert_refcount_tree(osb, new); in ocfs2_get_refcount_tree()
384 osb->osb_ref_tree_lru = tree; in ocfs2_get_refcount_tree()
386 spin_unlock(&osb->osb_lock); in ocfs2_get_refcount_tree()
416 static int __ocfs2_lock_refcount_tree(struct ocfs2_super *osb, in __ocfs2_lock_refcount_tree() argument
444 int ocfs2_lock_refcount_tree(struct ocfs2_super *osb, in ocfs2_lock_refcount_tree() argument
455 ret = ocfs2_get_refcount_tree(osb, ref_blkno, &tree); in ocfs2_lock_refcount_tree()
463 ret = __ocfs2_lock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
474 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
490 ocfs2_erase_refcount_tree_from_list(osb, tree); in ocfs2_lock_refcount_tree()
495 ocfs2_unlock_refcount_tree(osb, tree, rw); in ocfs2_lock_refcount_tree()
517 void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb, in ocfs2_unlock_refcount_tree() argument
529 void ocfs2_purge_refcount_trees(struct ocfs2_super *osb) in ocfs2_purge_refcount_trees() argument
533 struct rb_root *root = &osb->osb_rf_lock_tree; in ocfs2_purge_refcount_trees()
558 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_create_refcount_tree() local
571 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac); in ocfs2_create_refcount_tree()
577 handle = ocfs2_start_trans(osb, OCFS2_REFCOUNT_TREE_CREATE_CREDITS); in ocfs2_create_refcount_tree()
599 new_tree = ocfs2_allocate_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
628 rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); in ocfs2_create_refcount_tree()
632 cpu_to_le16(ocfs2_refcount_recs_per_rb(osb->sb)); in ocfs2_create_refcount_tree()
633 spin_lock(&osb->osb_lock); in ocfs2_create_refcount_tree()
634 rb->rf_generation = cpu_to_le32(osb->s_next_generation++); in ocfs2_create_refcount_tree()
635 spin_unlock(&osb->osb_lock); in ocfs2_create_refcount_tree()
654 ocfs2_init_refcount_tree_lock(osb, new_tree, first_blkno, in ocfs2_create_refcount_tree()
657 spin_lock(&osb->osb_lock); in ocfs2_create_refcount_tree()
658 tree = ocfs2_find_refcount_tree(osb, first_blkno); in ocfs2_create_refcount_tree()
668 ocfs2_erase_refcount_tree_from_list_no_lock(osb, tree); in ocfs2_create_refcount_tree()
669 ocfs2_insert_refcount_tree(osb, new_tree); in ocfs2_create_refcount_tree()
670 spin_unlock(&osb->osb_lock); in ocfs2_create_refcount_tree()
676 ocfs2_commit_trans(osb, handle); in ocfs2_create_refcount_tree()
699 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_set_refcount_tree() local
706 ret = ocfs2_lock_refcount_tree(osb, refcount_loc, 1, in ocfs2_set_refcount_tree()
713 handle = ocfs2_start_trans(osb, OCFS2_REFCOUNT_TREE_SET_CREDITS); in ocfs2_set_refcount_tree()
747 ocfs2_commit_trans(osb, handle); in ocfs2_set_refcount_tree()
749 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_set_refcount_tree()
761 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_remove_refcount_tree() local
775 ret = ocfs2_lock_refcount_tree(osb, ref_blkno, 1, &ref_tree, &blk_bh); in ocfs2_remove_refcount_tree()
795 alloc_inode = ocfs2_get_system_file_inode(osb, in ocfs2_remove_refcount_tree()
814 handle = ocfs2_start_trans(osb, credits); in ocfs2_remove_refcount_tree()
847 ocfs2_erase_refcount_tree_from_list(osb, ref_tree); in ocfs2_remove_refcount_tree()
855 ocfs2_commit_trans(osb, handle); in ocfs2_remove_refcount_tree()
867 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_remove_refcount_tree()
3006 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_duplicate_clusters_by_jbd() local
3014 new_bh = sb_getblk(osb->sb, new_block); in ocfs2_duplicate_clusters_by_jbd()
3177 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_make_clusters_writable() local
3201 handle = ocfs2_start_trans(osb, credits); in ocfs2_make_clusters_writable()
3304 ocfs2_commit_trans(osb, handle); in ocfs2_make_clusters_writable()
3327 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_replace_cow() local
3329 if (!ocfs2_refcount_tree(osb)) { in ocfs2_replace_cow()
3362 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_replace_cow()
3363 ocfs2_run_deallocs(osb, &context->dealloc); in ocfs2_replace_cow()
3380 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_refcount_cow_hunk() local
3409 ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), in ocfs2_refcount_cow_hunk()
3438 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_refcount_cow_hunk()
3659 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_add_refcount_flag() local
3677 ret = ocfs2_reserve_new_metadata_blocks(osb, in ocfs2_add_refcount_flag()
3688 handle = ocfs2_start_trans(osb, credits); in ocfs2_add_refcount_flag()
3718 ocfs2_commit_trans(osb, handle); in ocfs2_add_refcount_flag()
3766 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_attach_refcount_tree() local
3785 ret = ocfs2_lock_refcount_tree(osb, in ocfs2_attach_refcount_tree()
3844 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_attach_refcount_tree()
3848 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_attach_refcount_tree()
3849 ocfs2_run_deallocs(osb, &dealloc); in ocfs2_attach_refcount_tree()
3872 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_add_refcounted_extent() local
3885 handle = ocfs2_start_trans(osb, credits); in ocfs2_add_refcounted_extent()
3909 ocfs2_clusters_to_bytes(osb->sb, num_clusters)); in ocfs2_add_refcounted_extent()
3914 ocfs2_commit_trans(osb, handle); in ocfs2_add_refcounted_extent()
3928 struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb); in ocfs2_duplicate_inline_data() local
3934 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); in ocfs2_duplicate_inline_data()
3959 ocfs2_commit_trans(osb, handle); in ocfs2_duplicate_inline_data()
4096 struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb); in ocfs2_create_reflink_node() local
4117 ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), in ocfs2_create_reflink_node()
4133 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_create_reflink_node()
4137 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_create_reflink_node()
4138 ocfs2_run_deallocs(osb, &dealloc); in ocfs2_create_reflink_node()
4502 struct ocfs2_super *osb; in ocfs2_reflink_remap_extent() local
4509 osb = OCFS2_SB(s_inode->i_sb); in ocfs2_reflink_remap_extent()
4547 ret = ocfs2_lock_refcount_tree(osb, in ocfs2_reflink_remap_extent()
4582 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_reflink_remap_extent()
4592 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_reflink_remap_extent()
4611 struct ocfs2_super *osb; in ocfs2_reflink_remap_blocks() local
4616 osb = OCFS2_SB(s_inode->i_sb); in ocfs2_reflink_remap_blocks()
4693 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_reflink_remap_blocks()
4694 ocfs2_run_deallocs(osb, &dealloc); in ocfs2_reflink_remap_blocks()