aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/delayed-ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/delayed-ref.c')
-rw-r--r--fs/btrfs/delayed-ref.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index cb9b9a431fc9..125cf76fcd08 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -709,79 +709,3 @@ btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr)
709 return btrfs_delayed_node_to_head(ref); 709 return btrfs_delayed_node_to_head(ref);
710 return NULL; 710 return NULL;
711} 711}
712
713/*
714 * add a delayed ref to the tree. This does all of the accounting required
715 * to make sure the delayed ref is eventually processed before this
716 * transaction commits.
717 *
718 * The main point of this call is to add and remove a backreference in a single
719 * shot, taking the lock only once, and only searching for the head node once.
720 *
721 * It is the same as doing a ref add and delete in two separate calls.
722 */
723#if 0
724int btrfs_update_delayed_ref(struct btrfs_trans_handle *trans,
725 u64 bytenr, u64 num_bytes, u64 orig_parent,
726 u64 parent, u64 orig_ref_root, u64 ref_root,
727 u64 orig_ref_generation, u64 ref_generation,
728 u64 owner_objectid, int pin)
729{
730 struct btrfs_delayed_ref *ref;
731 struct btrfs_delayed_ref *old_ref;
732 struct btrfs_delayed_ref_head *head_ref;
733 struct btrfs_delayed_ref_root *delayed_refs;
734 int ret;
735
736 ref = kmalloc(sizeof(*ref), GFP_NOFS);
737 if (!ref)
738 return -ENOMEM;
739
740 old_ref = kmalloc(sizeof(*old_ref), GFP_NOFS);
741 if (!old_ref) {
742 kfree(ref);
743 return -ENOMEM;
744 }
745
746 /*
747 * the parent = 0 case comes from cases where we don't actually
748 * know the parent yet. It will get updated later via a add/drop
749 * pair.
750 */
751 if (parent == 0)
752 parent = bytenr;
753 if (orig_parent == 0)
754 orig_parent = bytenr;
755
756 head_ref = kmalloc(sizeof(*head_ref), GFP_NOFS);
757 if (!head_ref) {
758 kfree(ref);
759 kfree(old_ref);
760 return -ENOMEM;
761 }
762 delayed_refs = &trans->transaction->delayed_refs;
763 spin_lock(&delayed_refs->lock);
764
765 /*
766 * insert both the head node and the new ref without dropping
767 * the spin lock
768 */
769 ret = __btrfs_add_delayed_ref(trans, &head_ref->node, bytenr, num_bytes,
770 (u64)-1, 0, 0, 0,
771 BTRFS_UPDATE_DELAYED_HEAD, 0);
772 BUG_ON(ret);
773
774 ret = __btrfs_add_delayed_ref(trans, &ref->node, bytenr, num_bytes,
775 parent, ref_root, ref_generation,
776 owner_objectid, BTRFS_ADD_DELAYED_REF, 0);
777 BUG_ON(ret);
778
779 ret = __btrfs_add_delayed_ref(trans, &old_ref->node, bytenr, num_bytes,
780 orig_parent, orig_ref_root,
781 orig_ref_generation, owner_objectid,
782 BTRFS_DROP_DELAYED_REF, pin);
783 BUG_ON(ret);
784 spin_unlock(&delayed_refs->lock);
785 return 0;
786}
787#endif