diff options
| author | Jiri Kosina <jkosina@suse.cz> | 2011-06-10 14:46:48 +0200 | 
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2011-06-10 14:46:57 +0200 | 
| commit | 5be5758c114b18260c6fd4c8373bf89e39b0fe82 (patch) | |
| tree | 54390f904df6ff11e570f764c444356cf2709fda /fs/btrfs/delayed-ref.c | |
| parent | 71f66a6580c4e42df377bebbcca5c72661a40700 (diff) | |
| parent | 7f45e5cd1718ed769295033ca214032848a0097d (diff) | |
| download | olio-linux-3.10-5be5758c114b18260c6fd4c8373bf89e39b0fe82.tar.xz olio-linux-3.10-5be5758c114b18260c6fd4c8373bf89e39b0fe82.zip  | |
Merge branch 'master' into for-next
Sync with Linus' tree to be able to apply patches against new
code I have in queue.
Diffstat (limited to 'fs/btrfs/delayed-ref.c')
| -rw-r--r-- | fs/btrfs/delayed-ref.c | 114 | 
1 files changed, 0 insertions, 114 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index bce28f65389..125cf76fcd0 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -281,44 +281,6 @@ again:  }  /* - * This checks to see if there are any delayed refs in the - * btree for a given bytenr.  It returns one if it finds any - * and zero otherwise. - * - * If it only finds a head node, it returns 0. - * - * The idea is to use this when deciding if you can safely delete an - * extent from the extent allocation tree.  There may be a pending - * ref in the rbtree that adds or removes references, so as long as this - * returns one you need to leave the BTRFS_EXTENT_ITEM in the extent - * allocation tree. - */ -int btrfs_delayed_ref_pending(struct btrfs_trans_handle *trans, u64 bytenr) -{ -	struct btrfs_delayed_ref_node *ref; -	struct btrfs_delayed_ref_root *delayed_refs; -	struct rb_node *prev_node; -	int ret = 0; - -	delayed_refs = &trans->transaction->delayed_refs; -	spin_lock(&delayed_refs->lock); - -	ref = find_ref_head(&delayed_refs->root, bytenr, NULL); -	if (ref) { -		prev_node = rb_prev(&ref->rb_node); -		if (!prev_node) -			goto out; -		ref = rb_entry(prev_node, struct btrfs_delayed_ref_node, -			       rb_node); -		if (ref->bytenr == bytenr) -			ret = 1; -	} -out: -	spin_unlock(&delayed_refs->lock); -	return ret; -} - -/*   * helper function to update an extent delayed ref in the   * rbtree.  existing and update must both have the same   * bytenr and parent @@ -747,79 +709,3 @@ btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr)  		return btrfs_delayed_node_to_head(ref);  	return NULL;  } - -/* - * add a delayed ref to the tree.  This does all of the accounting required - * to make sure the delayed ref is eventually processed before this - * transaction commits. - * - * The main point of this call is to add and remove a backreference in a single - * shot, taking the lock only once, and only searching for the head node once. - * - * It is the same as doing a ref add and delete in two separate calls. - */ -#if 0 -int btrfs_update_delayed_ref(struct btrfs_trans_handle *trans, -			  u64 bytenr, u64 num_bytes, u64 orig_parent, -			  u64 parent, u64 orig_ref_root, u64 ref_root, -			  u64 orig_ref_generation, u64 ref_generation, -			  u64 owner_objectid, int pin) -{ -	struct btrfs_delayed_ref *ref; -	struct btrfs_delayed_ref *old_ref; -	struct btrfs_delayed_ref_head *head_ref; -	struct btrfs_delayed_ref_root *delayed_refs; -	int ret; - -	ref = kmalloc(sizeof(*ref), GFP_NOFS); -	if (!ref) -		return -ENOMEM; - -	old_ref = kmalloc(sizeof(*old_ref), GFP_NOFS); -	if (!old_ref) { -		kfree(ref); -		return -ENOMEM; -	} - -	/* -	 * the parent = 0 case comes from cases where we don't actually -	 * know the parent yet.  It will get updated later via a add/drop -	 * pair. -	 */ -	if (parent == 0) -		parent = bytenr; -	if (orig_parent == 0) -		orig_parent = bytenr; - -	head_ref = kmalloc(sizeof(*head_ref), GFP_NOFS); -	if (!head_ref) { -		kfree(ref); -		kfree(old_ref); -		return -ENOMEM; -	} -	delayed_refs = &trans->transaction->delayed_refs; -	spin_lock(&delayed_refs->lock); - -	/* -	 * insert both the head node and the new ref without dropping -	 * the spin lock -	 */ -	ret = __btrfs_add_delayed_ref(trans, &head_ref->node, bytenr, num_bytes, -				      (u64)-1, 0, 0, 0, -				      BTRFS_UPDATE_DELAYED_HEAD, 0); -	BUG_ON(ret); - -	ret = __btrfs_add_delayed_ref(trans, &ref->node, bytenr, num_bytes, -				      parent, ref_root, ref_generation, -				      owner_objectid, BTRFS_ADD_DELAYED_REF, 0); -	BUG_ON(ret); - -	ret = __btrfs_add_delayed_ref(trans, &old_ref->node, bytenr, num_bytes, -				      orig_parent, orig_ref_root, -				      orig_ref_generation, owner_objectid, -				      BTRFS_DROP_DELAYED_REF, pin); -	BUG_ON(ret); -	spin_unlock(&delayed_refs->lock); -	return 0; -} -#endif  |