Lines Matching full:existing

582  * Return true if the ref was merged into an existing one (and therefore can be
626 /* remove existing tail if its ref_mod is zero */ in insert_delayed_ref()
635 * existing and update must have the same bytenr
638 struct btrfs_delayed_ref_head *existing, in update_existing_head_ref() argument
646 BUG_ON(existing->is_data != update->is_data); in update_existing_head_ref()
648 spin_lock(&existing->lock); in update_existing_head_ref()
655 if (!existing->owning_root) in update_existing_head_ref()
656 existing->owning_root = update->owning_root; in update_existing_head_ref()
662 * with an existing head ref without in update_existing_head_ref()
666 existing->must_insert_reserved = update->must_insert_reserved; in update_existing_head_ref()
667 existing->owning_root = update->owning_root; in update_existing_head_ref()
673 existing->num_bytes = update->num_bytes; in update_existing_head_ref()
678 if (!existing->extent_op) { in update_existing_head_ref()
679 existing->extent_op = update->extent_op; in update_existing_head_ref()
682 memcpy(&existing->extent_op->key, in update_existing_head_ref()
685 existing->extent_op->update_key = true; in update_existing_head_ref()
688 existing->extent_op->flags_to_set |= in update_existing_head_ref()
690 existing->extent_op->update_flags = true; in update_existing_head_ref()
700 old_ref_mod = existing->total_ref_mod; in update_existing_head_ref()
701 existing->ref_mod += update->ref_mod; in update_existing_head_ref()
702 existing->total_ref_mod += update->ref_mod; in update_existing_head_ref()
710 if (existing->is_data) { in update_existing_head_ref()
713 existing->num_bytes); in update_existing_head_ref()
715 if (existing->total_ref_mod >= 0 && old_ref_mod < 0) { in update_existing_head_ref()
716 delayed_refs->pending_csums -= existing->num_bytes; in update_existing_head_ref()
719 if (existing->total_ref_mod < 0 && old_ref_mod >= 0) { in update_existing_head_ref()
720 delayed_refs->pending_csums += existing->num_bytes; in update_existing_head_ref()
725 spin_unlock(&existing->lock); in update_existing_head_ref()
817 struct btrfs_delayed_ref_head *existing; in add_delayed_ref_head() local
857 existing = xa_load(&delayed_refs->head_refs, index); in add_delayed_ref_head()
858 if (existing) { in add_delayed_ref_head()
859 update_existing_head_ref(trans, existing, head_ref); in add_delayed_ref_head()
861 * we've updated the existing ref, free the newly in add_delayed_ref_head()
865 head_ref = existing; in add_delayed_ref_head()
867 existing = xa_store(&delayed_refs->head_refs, index, head_ref, GFP_ATOMIC); in add_delayed_ref_head()
868 if (xa_is_err(existing)) { in add_delayed_ref_head()
870 ASSERT(xa_err(existing) != -ENOMEM); in add_delayed_ref_head()
871 return ERR_PTR(xa_err(existing)); in add_delayed_ref_head()
872 } else if (WARN_ON(existing)) { in add_delayed_ref_head()