Lines Matching refs:head_ref
730 static void init_delayed_ref_head(struct btrfs_delayed_ref_head *head_ref, in init_delayed_ref_head() argument
766 refcount_set(&head_ref->refs, 1); in init_delayed_ref_head()
767 head_ref->bytenr = bytenr; in init_delayed_ref_head()
768 head_ref->num_bytes = num_bytes; in init_delayed_ref_head()
769 head_ref->ref_mod = count_mod; in init_delayed_ref_head()
770 head_ref->must_insert_reserved = must_insert_reserved; in init_delayed_ref_head()
771 head_ref->is_data = is_data; in init_delayed_ref_head()
772 head_ref->is_system = is_system; in init_delayed_ref_head()
773 head_ref->ref_tree = RB_ROOT_CACHED; in init_delayed_ref_head()
774 INIT_LIST_HEAD(&head_ref->ref_add_list); in init_delayed_ref_head()
775 RB_CLEAR_NODE(&head_ref->href_node); in init_delayed_ref_head()
776 head_ref->processing = 0; in init_delayed_ref_head()
777 head_ref->total_ref_mod = count_mod; in init_delayed_ref_head()
778 spin_lock_init(&head_ref->lock); in init_delayed_ref_head()
779 mutex_init(&head_ref->mutex); in init_delayed_ref_head()
799 struct btrfs_delayed_ref_head *head_ref, in add_delayed_ref_head() argument
819 trace_add_delayed_ref_head(trans->fs_info, head_ref, action); in add_delayed_ref_head()
822 &head_ref->href_node); in add_delayed_ref_head()
824 update_existing_head_ref(trans, existing, head_ref, in add_delayed_ref_head()
830 kmem_cache_free(btrfs_delayed_ref_head_cachep, head_ref); in add_delayed_ref_head()
831 head_ref = existing; in add_delayed_ref_head()
835 if (head_ref->is_data && head_ref->ref_mod < 0) { in add_delayed_ref_head()
836 delayed_refs->pending_csums += head_ref->num_bytes; in add_delayed_ref_head()
839 head_ref->num_bytes); in add_delayed_ref_head()
849 *new_ref_mod = head_ref->total_ref_mod; in add_delayed_ref_head()
851 return head_ref; in add_delayed_ref_head()
917 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_tree_ref() local
938 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_tree_ref()
939 if (!head_ref) { in btrfs_add_delayed_tree_ref()
951 kmem_cache_free(btrfs_delayed_ref_head_cachep, head_ref); in btrfs_add_delayed_tree_ref()
967 init_delayed_ref_head(head_ref, record, bytenr, num_bytes, in btrfs_add_delayed_tree_ref()
970 head_ref->extent_op = extent_op; in btrfs_add_delayed_tree_ref()
979 head_ref = add_delayed_ref_head(trans, head_ref, record, in btrfs_add_delayed_tree_ref()
983 ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node); in btrfs_add_delayed_tree_ref()
1014 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_data_ref() local
1045 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_data_ref()
1046 if (!head_ref) { in btrfs_add_delayed_data_ref()
1059 head_ref); in btrfs_add_delayed_data_ref()
1064 init_delayed_ref_head(head_ref, record, bytenr, num_bytes, ref_root, in btrfs_add_delayed_data_ref()
1066 head_ref->extent_op = NULL; in btrfs_add_delayed_data_ref()
1075 head_ref = add_delayed_ref_head(trans, head_ref, record, in btrfs_add_delayed_data_ref()
1079 ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node); in btrfs_add_delayed_data_ref()
1104 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_extent_op() local
1107 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_extent_op()
1108 if (!head_ref) in btrfs_add_delayed_extent_op()
1111 init_delayed_ref_head(head_ref, NULL, bytenr, num_bytes, 0, 0, in btrfs_add_delayed_extent_op()
1114 head_ref->extent_op = extent_op; in btrfs_add_delayed_extent_op()
1119 add_delayed_ref_head(trans, head_ref, NULL, BTRFS_UPDATE_DELAYED_HEAD, in btrfs_add_delayed_extent_op()