Lines Matching full:existing
438 /* remove existing tail if its ref_mod is zero */ in insert_delayed_ref()
453 * existing and update must have the same bytenr
457 struct btrfs_delayed_ref_head *existing, in update_existing_head_ref() argument
463 BUG_ON(existing->is_data != update->is_data); in update_existing_head_ref()
465 spin_lock(&existing->lock); in update_existing_head_ref()
470 * with an existing head ref without in update_existing_head_ref()
474 existing->must_insert_reserved = update->must_insert_reserved; in update_existing_head_ref()
480 existing->num_bytes = update->num_bytes; in update_existing_head_ref()
485 if (!existing->extent_op) { in update_existing_head_ref()
486 existing->extent_op = update->extent_op; in update_existing_head_ref()
489 memcpy(&existing->extent_op->key, in update_existing_head_ref()
492 existing->extent_op->update_key = true; in update_existing_head_ref()
495 existing->extent_op->flags_to_set |= in update_existing_head_ref()
497 existing->extent_op->update_flags = true; in update_existing_head_ref()
507 old_ref_mod = existing->total_ref_mod; in update_existing_head_ref()
510 existing->ref_mod += update->ref_mod; in update_existing_head_ref()
511 existing->total_ref_mod += update->ref_mod; in update_existing_head_ref()
517 if (existing->is_data) { in update_existing_head_ref()
518 if (existing->total_ref_mod >= 0 && old_ref_mod < 0) in update_existing_head_ref()
519 delayed_refs->pending_csums -= existing->num_bytes; in update_existing_head_ref()
520 if (existing->total_ref_mod < 0 && old_ref_mod >= 0) in update_existing_head_ref()
521 delayed_refs->pending_csums += existing->num_bytes; in update_existing_head_ref()
523 spin_unlock(&existing->lock); in update_existing_head_ref()
603 struct btrfs_delayed_ref_head *existing; in add_delayed_ref_head() local
620 existing = htree_insert(&delayed_refs->href_root, in add_delayed_ref_head()
622 if (existing) { in add_delayed_ref_head()
625 && existing->qgroup_ref_root in add_delayed_ref_head()
626 && existing->qgroup_reserved); in add_delayed_ref_head()
627 update_existing_head_ref(delayed_refs, existing, head_ref, in add_delayed_ref_head()
630 * we've updated the existing ref, free the newly in add_delayed_ref_head()
634 head_ref = existing; in add_delayed_ref_head()