Lines Matching refs:head_ref
731 static void init_delayed_ref_head(struct btrfs_delayed_ref_head *head_ref, in init_delayed_ref_head() argument
767 refcount_set(&head_ref->refs, 1); in init_delayed_ref_head()
768 head_ref->bytenr = bytenr; in init_delayed_ref_head()
769 head_ref->num_bytes = num_bytes; in init_delayed_ref_head()
770 head_ref->ref_mod = count_mod; in init_delayed_ref_head()
771 head_ref->must_insert_reserved = must_insert_reserved; in init_delayed_ref_head()
772 head_ref->is_data = is_data; in init_delayed_ref_head()
773 head_ref->is_system = is_system; in init_delayed_ref_head()
774 head_ref->ref_tree = RB_ROOT_CACHED; in init_delayed_ref_head()
775 INIT_LIST_HEAD(&head_ref->ref_add_list); in init_delayed_ref_head()
776 RB_CLEAR_NODE(&head_ref->href_node); in init_delayed_ref_head()
777 head_ref->processing = 0; in init_delayed_ref_head()
778 head_ref->total_ref_mod = count_mod; in init_delayed_ref_head()
779 spin_lock_init(&head_ref->lock); in init_delayed_ref_head()
780 mutex_init(&head_ref->mutex); in init_delayed_ref_head()
800 struct btrfs_delayed_ref_head *head_ref, in add_delayed_ref_head() argument
820 trace_add_delayed_ref_head(trans->fs_info, head_ref, action); in add_delayed_ref_head()
823 &head_ref->href_node); in add_delayed_ref_head()
825 update_existing_head_ref(trans, existing, head_ref, in add_delayed_ref_head()
831 kmem_cache_free(btrfs_delayed_ref_head_cachep, head_ref); in add_delayed_ref_head()
832 head_ref = existing; in add_delayed_ref_head()
836 if (head_ref->is_data && head_ref->ref_mod < 0) { in add_delayed_ref_head()
837 delayed_refs->pending_csums += head_ref->num_bytes; in add_delayed_ref_head()
840 head_ref->num_bytes); in add_delayed_ref_head()
850 *new_ref_mod = head_ref->total_ref_mod; in add_delayed_ref_head()
852 return head_ref; in add_delayed_ref_head()
918 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_tree_ref() local
939 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_tree_ref()
940 if (!head_ref) { in btrfs_add_delayed_tree_ref()
952 kmem_cache_free(btrfs_delayed_ref_head_cachep, head_ref); in btrfs_add_delayed_tree_ref()
968 init_delayed_ref_head(head_ref, record, bytenr, num_bytes, in btrfs_add_delayed_tree_ref()
971 head_ref->extent_op = extent_op; in btrfs_add_delayed_tree_ref()
980 head_ref = add_delayed_ref_head(trans, head_ref, record, in btrfs_add_delayed_tree_ref()
984 ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node); in btrfs_add_delayed_tree_ref()
1015 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_data_ref() local
1046 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_data_ref()
1047 if (!head_ref) { in btrfs_add_delayed_data_ref()
1060 head_ref); in btrfs_add_delayed_data_ref()
1065 init_delayed_ref_head(head_ref, record, bytenr, num_bytes, ref_root, in btrfs_add_delayed_data_ref()
1067 head_ref->extent_op = NULL; in btrfs_add_delayed_data_ref()
1076 head_ref = add_delayed_ref_head(trans, head_ref, record, in btrfs_add_delayed_data_ref()
1080 ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node); in btrfs_add_delayed_data_ref()
1105 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_extent_op() local
1108 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_extent_op()
1109 if (!head_ref) in btrfs_add_delayed_extent_op()
1112 init_delayed_ref_head(head_ref, NULL, bytenr, num_bytes, 0, 0, in btrfs_add_delayed_extent_op()
1115 head_ref->extent_op = extent_op; in btrfs_add_delayed_extent_op()
1120 add_delayed_ref_head(trans, head_ref, NULL, BTRFS_UPDATE_DELAYED_HEAD, in btrfs_add_delayed_extent_op()