This is a simple adapter function to convert the delayed-refs structures
to the current arguments of alloc_reserved_tree_block.

Signed-off-by: Nikolay Borisov <[email protected]>
---
 extent-tree.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/extent-tree.c b/extent-tree.c
index 8789a43c7fea..3208ed11cb91 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -2687,6 +2687,30 @@ int btrfs_reserve_extent(struct btrfs_trans_handle 
*trans,
        return ret;
 }
 
+static int alloc_reserved_tree_block2(struct btrfs_trans_handle *trans,
+                                     struct btrfs_delayed_ref_node *node,
+                                     struct btrfs_delayed_extent_op *extent_op)
+{
+
+       struct btrfs_delayed_tree_ref *ref = 
btrfs_delayed_node_to_tree_ref(node);
+       struct btrfs_key ins;
+       bool skinny_metadata = btrfs_fs_incompat(trans->fs_info, 
SKINNY_METADATA);
+
+       ins.objectid = node->bytenr;
+       if (skinny_metadata) {
+               ins.offset = ref->level;
+               ins.type = BTRFS_METADATA_ITEM_KEY;
+       } else {
+               ins.offset = node->num_bytes;
+               ins.type = BTRFS_EXTENT_ITEM_KEY;
+       }
+
+       return alloc_reserved_tree_block(trans, ref->root, trans->transid,
+                                        extent_op->flags_to_set,
+                                        &extent_op->key, ref->level, &ins);
+
+}
+
 static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
                                     u64 root_objectid, u64 generation,
                                     u64 flags, struct btrfs_disk_key *key,
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to