Lines Matching refs:head_ref

526 static void init_delayed_ref_head(struct btrfs_delayed_ref_head *head_ref,  in init_delayed_ref_head()  argument
562 refcount_set(&head_ref->refs, 1); in init_delayed_ref_head()
563 head_ref->bytenr = bytenr; in init_delayed_ref_head()
564 head_ref->num_bytes = num_bytes; in init_delayed_ref_head()
565 head_ref->ref_mod = count_mod; in init_delayed_ref_head()
566 head_ref->must_insert_reserved = must_insert_reserved; in init_delayed_ref_head()
567 head_ref->is_data = is_data; in init_delayed_ref_head()
568 head_ref->is_system = is_system; in init_delayed_ref_head()
569 head_ref->ref_tree = RB_ROOT; in init_delayed_ref_head()
570 INIT_LIST_HEAD(&head_ref->ref_add_list); in init_delayed_ref_head()
571 RB_CLEAR_NODE(&head_ref->href_node); in init_delayed_ref_head()
572 head_ref->processing = 0; in init_delayed_ref_head()
573 head_ref->total_ref_mod = count_mod; in init_delayed_ref_head()
574 head_ref->qgroup_reserved = 0; in init_delayed_ref_head()
575 head_ref->qgroup_ref_root = 0; in init_delayed_ref_head()
576 spin_lock_init(&head_ref->lock); in init_delayed_ref_head()
577 mutex_init(&head_ref->mutex); in init_delayed_ref_head()
581 head_ref->qgroup_ref_root = ref_root; in init_delayed_ref_head()
582 head_ref->qgroup_reserved = reserved; in init_delayed_ref_head()
598 struct btrfs_delayed_ref_head *head_ref, in add_delayed_ref_head() argument
618 trace_add_delayed_ref_head(trans->fs_info, head_ref, action); in add_delayed_ref_head()
621 &head_ref->href_node); in add_delayed_ref_head()
623 WARN_ON(qrecord && head_ref->qgroup_ref_root in add_delayed_ref_head()
624 && head_ref->qgroup_reserved in add_delayed_ref_head()
627 update_existing_head_ref(delayed_refs, existing, head_ref, in add_delayed_ref_head()
633 kmem_cache_free(btrfs_delayed_ref_head_cachep, head_ref); in add_delayed_ref_head()
634 head_ref = existing; in add_delayed_ref_head()
638 if (head_ref->is_data && head_ref->ref_mod < 0) in add_delayed_ref_head()
639 delayed_refs->pending_csums += head_ref->num_bytes; in add_delayed_ref_head()
648 *new_ref_mod = head_ref->total_ref_mod; in add_delayed_ref_head()
650 return head_ref; in add_delayed_ref_head()
717 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_tree_ref() local
730 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_tree_ref()
731 if (!head_ref) { in btrfs_add_delayed_tree_ref()
741 kmem_cache_free(btrfs_delayed_ref_head_cachep, head_ref); in btrfs_add_delayed_tree_ref()
757 init_delayed_ref_head(head_ref, record, bytenr, num_bytes, in btrfs_add_delayed_tree_ref()
759 head_ref->extent_op = extent_op; in btrfs_add_delayed_tree_ref()
768 head_ref = add_delayed_ref_head(trans, head_ref, record, in btrfs_add_delayed_tree_ref()
772 ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node); in btrfs_add_delayed_tree_ref()
798 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_data_ref() local
821 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_data_ref()
822 if (!head_ref) { in btrfs_add_delayed_data_ref()
833 head_ref); in btrfs_add_delayed_data_ref()
838 init_delayed_ref_head(head_ref, record, bytenr, num_bytes, ref_root, in btrfs_add_delayed_data_ref()
840 head_ref->extent_op = NULL; in btrfs_add_delayed_data_ref()
849 head_ref = add_delayed_ref_head(trans, head_ref, record, in btrfs_add_delayed_data_ref()
853 ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node); in btrfs_add_delayed_data_ref()
873 struct btrfs_delayed_ref_head *head_ref; in btrfs_add_delayed_extent_op() local
876 head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); in btrfs_add_delayed_extent_op()
877 if (!head_ref) in btrfs_add_delayed_extent_op()
880 init_delayed_ref_head(head_ref, NULL, bytenr, num_bytes, 0, 0, in btrfs_add_delayed_extent_op()
883 head_ref->extent_op = extent_op; in btrfs_add_delayed_extent_op()
888 add_delayed_ref_head(trans, head_ref, NULL, BTRFS_UPDATE_DELAYED_HEAD, in btrfs_add_delayed_extent_op()