Lines Matching refs:head_ref

529 static void init_delayed_ref_head(struct btrfs_delayed_ref_head *head_ref,  in init_delayed_ref_head()  argument
565 refcount_set(&head_ref->refs, 1); in init_delayed_ref_head()
566 head_ref->bytenr = bytenr; in init_delayed_ref_head()
567 head_ref->num_bytes = num_bytes; in init_delayed_ref_head()
568 head_ref->ref_mod = count_mod; in init_delayed_ref_head()
569 head_ref->must_insert_reserved = must_insert_reserved; in init_delayed_ref_head()
570 head_ref->is_data = is_data; in init_delayed_ref_head()
571 head_ref->is_system = is_system; in init_delayed_ref_head()
572 head_ref->ref_tree = RB_ROOT; in init_delayed_ref_head()
573 INIT_LIST_HEAD(&head_ref->ref_add_list); in init_delayed_ref_head()
574 RB_CLEAR_NODE(&head_ref->href_node); in init_delayed_ref_head()
575 head_ref->processing = 0; in init_delayed_ref_head()
576 head_ref->total_ref_mod = count_mod; in init_delayed_ref_head()
577 head_ref->qgroup_reserved = 0; in init_delayed_ref_head()
578 head_ref->qgroup_ref_root = 0; in init_delayed_ref_head()
579 spin_lock_init(&head_ref->lock); in init_delayed_ref_head()
580 mutex_init(&head_ref->mutex); in init_delayed_ref_head()
584 head_ref->qgroup_ref_root = ref_root; in init_delayed_ref_head()
585 head_ref->qgroup_reserved = reserved; in init_delayed_ref_head()
601 struct btrfs_delayed_ref_head *head_ref, in add_delayed_ref_head() argument
621 trace_add_delayed_ref_head(trans->fs_info, head_ref, action); in add_delayed_ref_head()
624 &head_ref->href_node); in add_delayed_ref_head()
626 WARN_ON(qrecord && head_ref->qgroup_ref_root in add_delayed_ref_head()
627 && head_ref->qgroup_reserved in add_delayed_ref_head()
630 update_existing_head_ref(delayed_refs, existing, head_ref, in add_delayed_ref_head()
636 kmem_cache_free(btrfs_delayed_ref_head_cachep, head_ref); in add_delayed_ref_head()
637 head_ref = existing; in add_delayed_ref_head()
641 if (head_ref->is_data && head_ref->ref_mod < 0) in add_delayed_ref_head()
642 delayed_refs->pending_csums += head_ref->num_bytes; in add_delayed_ref_head()
651 *new_ref_mod = head_ref->total_ref_mod; in add_delayed_ref_head()
653 return head_ref; in add_delayed_ref_head()
720 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_tree_ref() local
733 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_tree_ref()
734 if (!head_ref) { in btrfs_add_delayed_tree_ref()
744 kmem_cache_free(btrfs_delayed_ref_head_cachep, head_ref); in btrfs_add_delayed_tree_ref()
760 init_delayed_ref_head(head_ref, record, bytenr, num_bytes, in btrfs_add_delayed_tree_ref()
762 head_ref->extent_op = extent_op; in btrfs_add_delayed_tree_ref()
771 head_ref = add_delayed_ref_head(trans, head_ref, record, in btrfs_add_delayed_tree_ref()
775 ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node); in btrfs_add_delayed_tree_ref()
801 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_data_ref() local
824 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_data_ref()
825 if (!head_ref) { in btrfs_add_delayed_data_ref()
836 head_ref); in btrfs_add_delayed_data_ref()
841 init_delayed_ref_head(head_ref, record, bytenr, num_bytes, ref_root, in btrfs_add_delayed_data_ref()
843 head_ref->extent_op = NULL; in btrfs_add_delayed_data_ref()
852 head_ref = add_delayed_ref_head(trans, head_ref, record, in btrfs_add_delayed_data_ref()
856 ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node); in btrfs_add_delayed_data_ref()
876 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_extent_op() local
879 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_extent_op()
880 if (!head_ref) in btrfs_add_delayed_extent_op()
883 init_delayed_ref_head(head_ref, NULL, bytenr, num_bytes, 0, 0, in btrfs_add_delayed_extent_op()
886 head_ref->extent_op = extent_op; in btrfs_add_delayed_extent_op()
891 add_delayed_ref_head(trans, head_ref, NULL, BTRFS_UPDATE_DELAYED_HEAD, in btrfs_add_delayed_extent_op()